aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/json/decoding.rb
Commit message (Collapse)AuthorAgeFilesLines
* [Active Support] require_relative => requireAkira Matsuda2017-10-211-2/+2
| | | | This basically reverts 8da30ad6be34339124ba4cb4e36aea260dda12bc
* [Active Support] `rubocop -a --only Layout/EmptyLineAfterMagicComment`Koichi ITO2017-07-111-0/+1
|
* Use frozen-string-literal in ActiveSupportKir Shatrov2017-07-091-0/+1
|
* [Active Support] require => require_relativeAkira Matsuda2017-07-011-2/+2
|
* applies new string literal convention in activesupport/libXavier Noria2016-08-061-3/+3
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Use correct timezone when parsing date in jsonGrzegorz Witek2016-01-221-2/+9
| | | | | | | | | | | | | Fixes https://github.com/rails/rails/issues/22171 Time specified in ISO 8601 format without `Z` should be considered as local time, yet until now it was treated as UTC. This commit fixes problem by parsing time using timezone specified in application config. The downside of this solution is performance hit (`Time.zone.parse` is ~ 1.6x slower than `Time.parse`), so maybe there's a better solution.
* Remove not used `options` argument from `ActiveSupport::JSON.decode`Carlos Antonio da Silva2015-05-131-8/+2
| | | | | | In Rails 4.0, json decoding relied on MultiJson. This changed from 4.1 forward since it reached its end of life, and this extra argument was kept for compatibility. We are safe to remove it now.
* specify protocol for external linksRobin Neumann2014-10-151-1/+1
| | | | to ensure correct parsing result of rdoc
* Moved AS::JSON::DATE_REGEX as it's only used for decodingGodfrey Chan2013-11-061-0/+3
|
* Raise an error when AS::JSON.decode is called with optionsGodfrey Chan2013-10-301-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | Rails 4.1 has switched away from MultiJson, and does not currently support any options on `ActiveSupport::JSON.decode`. Passing in unsupported options (i.e. any non-empty options hash) will now raise an ArgumentError. Rationale: 1. We cannot guarantee the underlying JSON parser won't change in the future, hence we cannot guarantee a consistent set of options the method could take 2. The `json` gem, which happens to be the current JSON parser, takes many dangerous options that is irrelevant to the purpose of AS's JSON decoding API 3. To reserve the options hash for future use, e.g. overriding default global options like ActiveSupport.parse_json_times This change *DOES NOT* introduce any changes in the public API. The signature of the method is still decode(json_text, options). The difference is this method previously accepted undocumented options which does different things when the underlying adapter changes. It now correctly raises an ArgumentError when it encounters options that it does not recognize (and currently it does not support any options).
* Enabled quirks mode on JSON.parse, fixes broken test in af9caaeGodfrey Chan2013-09-121-1/+1
| | | | | | | It turns out that ActionPack depends on the decoder to parse JSON "fragments" (e.g. '"a string"', '1', 'null', etc), so we need to enable quirks mode on JSON.parse. Also added coverage on the decoder side to prevent regression.
* Replace JSON.load with JSON.parse, also removed the proc parameterGodfrey Chan2013-09-111-2/+2
| | | | | | | | | | | | | Since we are dealing with untrusted user input, we should not be using JSON.load. According to the docs[1]: BEWARE: This method is meant to serialise data from trusted user input, like from your own database server or clients under your control, it could be dangerous to allow untrusted users to pass JSON sources into it. The default options for the parser can be changed via the ::load_default_options method. [1] http://www.ruby-doc.org/stdlib-2.0/libdoc/json/rdoc/JSON.html#method-i-load
* Replace multi_json with jsonErik Michaels-Ober2013-05-111-21/+4
|
* update AS/json docs [ci skip]Francesco Rodriguez2012-09-141-2/+4
|
* Document ActiveSupport::JSON.parse_error [ci skip]Mark Rushakoff2012-06-051-0/+8
|
* add ActiveSupport::JSON.decode documentation [ci skip]Francesco Rodriguez2012-05-281-0/+5
|
* fixed broken build after multi_json upgradeArun Agrawal2012-04-161-3/+3
| | | Multi_json also upgraded.
* AS Json parse_error makes a return for backwards compatibility, although it ↵Josh Kalderimis2011-04-191-0/+4
| | | | will return MultiJson::DecodeError
* removed AS backends and instead rely on MultiJson for json decodingJosh Kalderimis2011-04-181-23/+33
|
* removes spurious .rb in requireSantiago Pastorino2010-06-131-1/+1
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* Disprefer JSONGem decoder since it only decodes JSON objectsJeremy Kemper2010-03-091-1/+1
|
* Automatically prefer Yajl or JSON backend over Yaml, if availableJeremy Kemper2010-02-051-1/+16
|
* Clean up spurious JSON decoding test failureJeremy Kemper2009-09-131-0/+2
|
* Add basic JSON serializer to AMoJoshua Peek2009-06-171-0/+1
|
* Simplify json decoder backend lazy loadJeremy Kemper2009-06-081-4/+2
|
* JSON: split encoding and coercionJeremy Kemper2009-06-081-0/+35
|
* * Add pluggable JSON backends with support for the JSON gem. [rick]rick2009-04-231-82/+0
| | | | | | | | | | | | | | Example: ActiveSupport::JSON.backend = "JSONGem" All internal Rails JSON encoding is now handled by ActiveSupport::JSON.encode(). Use of #to_json is not recommended, as it may clash with other libraries that overwrite it. However, you can recover Rails specific functionality if you really want to use #to_json. gem 'json' ActiveSupport::JSON.backend = "JSONGem" class ActiveRecord::Base alias to_json rails_to_json end
* stdlib autoloads were hanging on 1.9.1Jeremy Kemper2009-04-221-4/+2
|
* Autoload YAML and StringScanner for JSON decodingJeremy Kemper2009-04-171-2/+2
|
* Explicit dependency on String#start_with? extensionJeremy Kemper2009-03-281-3/+5
|
* Reverted affe50105f7027a44eb6e9cfb56f5b3fc070b19b and added more JSON ↵Ubiratan Pires Alberton2009-03-111-1/+10
| | | | | | | | | | decoding tests. Works on Ruby 1.8 and 1.9 [#1100 state:resolved] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Remove untested part from 9b9b2937ce3bef3bca9d22821e76c40cc74fa689Pratik Naik2009-03-101-10/+2
|
* Properly decode \u escape sequences in JSON [#1100 state:resolved] [Tim ↵Tim Pope2009-03-101-3/+20
| | | | | | Pope, Philip Hallstrom] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Ruby 1.9 compat: fix JSON decoding to work properly with multibyte valuesAkira Matsuda2009-02-171-2/+3
| | | | | | [#1969 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Fix JSON decoder date-converter regexp [#1662 state:resolved] [Jonathan del ↵Pratik Naik2009-01-071-1/+1
| | | | Strother]
* Merge docrails.Pratik Naik2008-05-251-1/+1
| | | | Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* remove multiple enumerations from ActiveSupport::JSON#convert_json_to_yaml ↵Rick Olson2007-12-281-5/+8
| | | | | | when dealing with date/time values. [rick] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8505 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fix JSON encoding/decoding bugs dealing with /'s. Closes #9990 [Rick, ↵Rick Olson2007-10-261-1/+2
| | | | | | theamazingrando] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8026 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Don't shadow local var with block varJeremy Kemper2007-10-131-1/+1
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7865 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* JSON decoding Ruby 1.9 compat. Mark a section that's unnecessarily slow.Jeremy Kemper2007-09-291-5/+6
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7678 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Decode json strings as Dates/Times if they're using a YAML-compatible ↵Rick Olson2007-09-241-5/+18
| | | | | | format. Closes #9614 [Rick] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7613 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fix JSON decoder with nested quotes and commas. Closes #9579.Jeremy Kemper2007-09-171-4/+9
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7506 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Refactor ActiveSupport::JSON to be less obtuse. Add support for JSON ↵Sam Stephenson2007-03-181-0/+40
decoding by way of Syck with ActiveSupport::JSON.decode(json_string). Prevent hash keys that are JavaScript reserved words from being unquoted during encoding. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6443 5ecf4fe2-1ee6-0310-87b1-e25e094e27de