aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/json
Commit message (Collapse)AuthorAgeFilesLines
* Fix test to ruby 2.0Rafael Mendonça França2013-05-101-2/+9
| | | | The default enconding changed on Ruby 2.0
* Revert "Remove unicode character encoding from ActiveSupport::JSON.encode"Rafael Mendonça França2013-05-081-15/+9
| | | | | | | | | | | | This reverts commit 815a9431ab61376a7e8e1bdff21f87bc557992f8. Conflicts: activesupport/test/json/encoding_test.rb Reason: This was causing a regression where the resulting string is always returning UTF-8. Also it changes the behavior of this method on a stable release. Fixes #9498.
* Use 1.8 style hash in json encoding testCarlos Antonio da Silva2012-12-141-1/+1
|
* Remove unicode character encoding from ActiveSupport::JSON.encodeBrett Carter2012-12-141-3/+16
| | | | | | | | | | | | | | | | | | The encoding scheme (e.g. ☠ -> "\u2620") was broken for characters not in the Basic Multilingual Plane. It is possible to escape them for json using the weird encoding scheme of a twelve-character sequence representing the UTF-16 surrogate pair (e.g. '𠜎' -> "\u270e\u263a") but this wasn't properly handled in the escaping code. Since raw UTF-8 is allowed in json, it was decided to simply pass through the raw bytes rather than attempt to escape them. Backport of https://github.com/zbskii/rails/commit/9ace3a8820a5270f9b3f37b593f8bbea3e940f73 Conflicts: activesupport/CHANGELOG.md activesupport/lib/active_support/json/encoding.rb activesupport/test/json/encoding_test.rb
* Fix json encoding test with ruby 1.8.7 and random hash orderCarlos Antonio da Silva2012-11-131-1/+2
| | | | Introduced in 3e53fe6.
* backport #8185, `#as_json` isolates options when encoding a hash.Yves Senn2012-11-131-0/+18
| | | | | | | | | | Setting options in a custom `#as_json` method had side effects. Modifications of the `options` hash leaked outside and influenced the conversion of other objects contained in the hash. Conflicts: activesupport/CHANGELOG.md
* Revert "Deprecate ActiveSupport::JSON::Variable"Rafael Mendonça França2012-08-011-8/+3
| | | | This reverts commit bcfa013399fd2c5b5d25c38912cba3560de1cc57.
* Deprecate ActiveSupport::JSON::VariableErich Menge2012-05-301-3/+8
|
* True, False, and Nil should be represented in as_json as themselves.Erich Menge2012-05-301-0/+6
| | | | | | | Conflicts: activesupport/lib/active_support/json/encoding.rb activesupport/test/json/encoding_test.rb
* Removing extra requires from the test. Already loaded in abstract_unit.Arun Agrawal2011-07-311-1/+0
|
* checked all .rb files in the project tree for missing magic comments, one ↵Xavier Noria2011-07-231-1/+1
| | | | | | | | | | | | | | was missing Came with this one-liner for this: find . -name '*.rb' | \ xargs chardet | \ grep -v ascii | \ cut -d: -f1 -s | \ xargs -n1 ruby -0777 -ne 'puts $FILENAME if $_ !~ /#.*coding:\s*utf/i' Welcome $_.
* Merge pull request #248 from bigfix/enumerable_as_jsonJosé Valim2011-05-071-9/+24
|\ | | | | Enumerable should pass encoding options to children in #as_json/#to_json
| * Enumerable should pass encoding options to children in #as_json/#to_json.John Firebaugh2011-04-011-9/+24
| |
* | AS Json parse_error makes a return for backwards compatibility, although it ↵Josh Kalderimis2011-04-191-1/+1
| | | | | | | | will return MultiJson::DecodeError
* | removed AS backends and instead rely on MultiJson for json decodingJosh Kalderimis2011-04-181-7/+4
|/
* parse dates to yaml in json arraysDiego Carrion2011-03-221-0/+2
| | | | Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* test json decoding with time parsing disabled with all backends and respect ↵Diego Carrion2011-03-221-4/+2
| | | | | | ActiveSupport.parse_json_times when converting to yaml Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* Updated the json date regex to recognize xmlschema formatted date times ↵Josh Kalderimis2011-02-121-0/+4
| | | | | | during json decoding. [#3031 state:resolved] Signed-off-by: Santiago Pastorino and Emilio Tagua <santiago+emilioe@wyeworks.com>
* Fixes an issue when decoding a json string which looks like a date but is ↵Josh Kalderimis2011-02-111-0/+2
| | | | | | invalid. This DateTime parse error is now caught and the original string is instead passed back [#6286 state:resolved] Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* Fix tests providing valid JSONSantiago Pastorino2011-02-021-2/+2
|
* Fix JSON decoding of newline character with Yaml backend [#3479 state:resolved]Maxime RETY2011-02-021-1/+5
| | | | Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* use ! " " YAML string literal syntax rather than removing both quotesAaron Patterson2011-01-211-3/+1
|
* ordering can change depending on ruby version, so parse the JSON and verify ↵Aaron Patterson2011-01-171-3/+10
| | | | data structure equality
* Complex struct encoding testAlexey Nayden2011-01-151-0/+23
| | | | Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* Fixed various isolated test missing requires within AS.Josh Kalderimis2011-01-121-0/+1
| | | | Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* fixed some issues with JSON encodingJakub Suder2010-09-071-1/+64
| | | | | | | | | | | - as_json in ActiveModel should return a hash and handle :only/:except/:methods options - Array and Hash should call as_json on their elements - json methods should not modify options argument [#5374 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Removes unused varsSantiago Pastorino2010-07-241-1/+1
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* Time has it own implementation of xmlschema, now AMo doesn't depend on TZInfoSantiago Pastorino2010-07-021-2/+4
| | | | | | [#4979 state:committed] Signed-off-by: José Valim <jose.valim@gmail.com>
* BigDecimal#as_json does not really specify the F format, it delegates that ↵Xavier Noria2010-05-031-1/+3
| | | | to whatever BigDecimal#to_s default format is, do the same in its test
* Fix BigDecimal JSON encoding test. [#4495 state:resolved]Cezary Baginski2010-04-281-3/+3
| | | | Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* JSON: encode objects that don't have a native JSON representation using ↵Jeremy Kemper2010-04-261-2/+19
| | | | to_hash, if available, instead of instance_values (the old fallback) or to_s (other encoders' default). Encode BigDecimal and Regexp encode as strings to conform with other encoders. Try to transcode non-UTF-8 strings.
* Fix a JSON ordering issueYehuda Katz2010-02-101-3/+7
|
* Automatically prefer Yajl or JSON backend over Yaml, if availableJeremy Kemper2010-02-051-1/+1
|
* Add yajl-ruby as a JSON parsing backendBrian Lopez2010-02-051-0/+1
| | | | | | [#2666 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Fix ActiveSupport::JSON encoding of control characters [\x00-\x1f]Dwayne Litzenberger2009-12-231-1/+3
| | | | | | | | | | | | | | According to RFC 4627, only the following Unicode code points are allowed unescaped in JSON: unescaped = %x20-21 / %x23-5B / %x5D-10FFFF However, ActiveSupport::JSON did not escape the range %x00-1f. This caused parse errors when trying to decode the resulting output. [#3345 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Repair time dependenciesJeremy Kemper2009-11-141-0/+1
|
* Clean up spurious JSON decoding test failureJeremy Kemper2009-09-131-8/+2
|
* Fix that JSON parser fails to read escaped backslashes.Daniel Sheppard2009-08-091-3/+5
| | | | | | [#973 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Fixed a bug in JSON decoding with Yaml backend, where a combination of ↵Bas Van Klinkenberg2009-08-081-1/+7
| | | | | | dates, escaped or unicode encoded data and arrays would make the parser fail with a ParseError exception. [#2831 state:resolved] Signed-off-by: Yehuda Katz <wycats@gmail.com>
* JSON.escape returns UTF-8 stringsJeremy Kemper2009-07-011-2/+7
| | | | [#2849 state:resolved]
* JSON: split encoding and coercionJeremy Kemper2009-06-081-7/+12
|
* load the JSON Backend lazily. If the JSON gem is already loaded, use the ↵rick2009-05-171-0/+3
| | | | JSONGem backend by default.
* Privatize rails_to_jsonJeremy Kemper2009-04-261-1/+1
|
* * Add pluggable JSON backends with support for the JSON gem. [rick]rick2009-04-232-44/+70
| | | | | | | | | | | | | | 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
* Opt in to JSONJeremy Kemper2009-04-221-0/+1
|
* stdlib autoloads were hanging on 1.9.1Jeremy Kemper2009-04-221-2/+2
|
* Explicit test dependenciesJeremy Kemper2009-03-281-0/+1
|
* Reverted affe50105f7027a44eb6e9cfb56f5b3fc070b19b and added more JSON ↵Ubiratan Pires Alberton2009-03-111-1/+3
| | | | | | | | | | decoding tests. Works on Ruby 1.8 and 1.9 [#1100 state:resolved] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Properly decode \u escape sequences in JSON [#1100 state:resolved] [Tim ↵Tim Pope2009-03-101-1/+3
| | | | | | Pope, Philip Hallstrom] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Ruby 1.9 compat: rename deprecated assert_raises to assert_raise.Jeremy Kemper2009-03-082-2/+2
| | | | [#1617 state:resolved]