JSON only supports objects, just not true - json.org also does not offer this imo. it was derived from javascript, and therefore especially strings and numbers are also valid JSON:
var json_string = "1"; var p = eval('(' + json_string + ')'); console.log(p);
ActiveSupport::JSON correctly understands the original JSON value:
require 'active_support/json' p = ActiveSupport::JSON.decode '1'
as well as MultiJson :
require 'multi_json' p = MultiJson.load '1'
therefore, as mentioned in a2800276, this should be a mistake.
but at the time of this writing, Ruby 2 JSON was using quirks_mode by default when using the load method.
require 'json' p = JSON.load '1'
glasz source share