Parses a JSON string or IO and convert it into an object
# File lib/active_support/json/backends/jsongem.rb, line 11 11: def decode(json) 12: if json.respond_to?(:read) 13: json = json.read 14: end 15: data = ::JSON.parse(json) 16: if ActiveSupport.parse_json_times 17: convert_dates_from(data) 18: else 19: data 20: end 21: end
# File lib/active_support/json/backends/jsongem.rb, line 24 24: def convert_dates_from(data) 25: case data 26: when nil 27: nil 28: when DATE_REGEX 29: DateTime.parse(data) 30: when Array 31: data.map! { |d| convert_dates_from(d) } 32: when Hash 33: data.each do |key, value| 34: data[key] = convert_dates_from(value) 35: end 36: else 37: data 38: end 39: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.