Sha256: a5bbbc6aa53ffd2abaaa2adab13c9fc188aa46572ff5c4999686e776c4540676
Contents?: true
Size: 945 Bytes
Versions: 2
Compression:
Stored size: 945 Bytes
Contents
require 'json' unless defined?(JSON) module ActiveSupport module JSON module Backends module JSONGem ParseError = ::JSON::ParserError extend self # Parses a JSON string or IO and convert it into an object def decode(json) if json.respond_to?(:read) json = json.read end data = ::JSON.parse(json) if ActiveSupport.parse_json_times convert_dates_from(data) else data end end private def convert_dates_from(data) case data when DATE_REGEX DateTime.parse(data) when Array data.map! { |d| convert_dates_from(d) } when Hash data.each do |key, value| data[key] = convert_dates_from(value) end else data end end end end end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
activesupport-3.0.pre | lib/active_support/json/backends/jsongem.rb |
recliner-0.0.1 | vendor/activesupport/lib/active_support/json/backends/jsongem.rb |