Josh Kalderimis
1d8be7bc6f
AS Json parse_error makes a return for backwards compatibility, although it will return MultiJson::DecodeError
2011-04-19 00:01:50 +02:00
Josh Kalderimis
e019587e31
removed AS backends and instead rely on MultiJson for json decoding
2011-04-18 21:39:15 +02:00
Diego Carrion
a1edbf7206
parse dates to yaml in json arrays
...
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com >
2011-03-22 21:09:54 -03:00
Diego Carrion
7004434ad8
test json decoding with time parsing disabled with all backends and respect ActiveSupport.parse_json_times when converting to yaml
...
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com >
2011-03-22 21:09:54 -03:00
Josh Kalderimis
e8c870726a
Updated the json date regex to recognize xmlschema formatted date times during json decoding. [ #3031 state:resolved]
...
Signed-off-by: Santiago Pastorino and Emilio Tagua <santiago+emilioe@wyeworks.com >
2011-02-12 13:30:30 -02:00
Josh Kalderimis
b17d8d727f
Fixes an issue when decoding a json string which looks like a date but is 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 >
2011-02-11 13:54:57 -02:00
Santiago Pastorino
434aa09560
Fix tests providing valid JSON
2011-02-02 20:53:03 -02:00
Maxime RETY
68e3fb8109
Fix JSON decoding of newline character with Yaml backend [ #3479 state:resolved]
...
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com >
2011-02-02 18:57:48 -02:00
Aaron Patterson
370bcd1a01
use ! " " YAML string literal syntax rather than removing both quotes
2011-01-21 14:09:59 -08:00
Jeremy Kemper
63bb955a99
Automatically prefer Yajl or JSON backend over Yaml, if available
2010-02-05 10:22:45 -08:00
Brian Lopez
a96bf4ab5e
Add yajl-ruby as a JSON parsing backend
...
[#2666 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2010-02-05 10:15:51 -08:00
Jeremy Kemper
bc1538e995
Repair time dependencies
2009-11-14 11:37:06 -08:00
Jeremy Kemper
053a0f6ac4
Clean up spurious JSON decoding test failure
2009-09-13 05:43:02 -07:00
Daniel Sheppard
b3381cacaf
Fix that JSON parser fails to read escaped backslashes.
...
[#973 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2009-08-09 22:30:44 -07:00
Bas Van Klinkenberg
0fbeaa98e4
Fixed a bug in JSON decoding with Yaml backend, where a combination of 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 >
2009-08-08 12:44:41 -03:00
rick
e89241c92f
load the JSON Backend lazily. If the JSON gem is already loaded, use the JSONGem backend by default.
2009-05-17 19:18:00 -07:00
rick
3c4c6bd0df
* Add pluggable JSON backends with support for the JSON gem. [rick]
...
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
2009-04-23 00:08:40 -07:00
Jeremy Kemper
6fee981fa4
Opt in to JSON
2009-04-22 16:48:58 -07:00
Jeremy Kemper
42a06d2d62
stdlib autoloads were hanging on 1.9.1
2009-04-22 09:10:48 -07:00
Ubiratan Pires Alberton
7b382cb9e5
Reverted affe50105f and added more JSON decoding tests.
...
Works on Ruby 1.8 and 1.9
[#1100 state:resolved]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2009-03-11 14:36:14 -07:00
Tim Pope
9b9b2937ce
Properly decode \u escape sequences in JSON [ #1100 state:resolved] [Tim Pope, Philip Hallstrom]
...
Signed-off-by: Pratik Naik <pratiknaik@gmail.com >
2009-03-10 17:05:17 +00:00
Jeremy Kemper
1c36172c13
Ruby 1.9 compat: rename deprecated assert_raises to assert_raise.
...
[#1617 state:resolved]
2009-03-08 13:11:58 -07:00
Akira Matsuda
7c0e008973
Ruby 1.9 compat: fix JSON decoding to work properly with multibyte values
...
[#1969 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net >
2009-02-17 11:58:53 -08:00
Pratik Naik
17da45b789
Fix JSON decoder date-converter regexp [ #1662 state:resolved] [Jonathan del Strother]
2009-01-07 17:51:11 +00:00
Jeremy Kemper
f6d8526659
require abstract_unit directly since test is in load path
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8563 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-05 13:31:04 +00:00
Rick Olson
34c125d774
Fix JSON encoding/decoding bugs dealing with /'s. Closes #9990 [Rick, theamazingrando]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8026 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-10-26 03:22:02 +00:00
Rick Olson
2a60093fa3
Decode json strings as Dates/Times if they're using a YAML-compatible format. Closes #9614 [Rick]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7613 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-09-24 17:41:55 +00:00
Jeremy Kemper
71e33d9650
Fix JSON decoder with nested quotes and commas. Closes #9579 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7506 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-09-17 21:37:48 +00:00
Jeremy Kemper
3aadfcef88
Improve various test coverage. Closes #8676 [kamal]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7117 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-06-25 18:22:31 +00:00
Sam Stephenson
3202fbabe6
Refactor ActiveSupport::JSON to be less obtuse. Add support for JSON 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
2007-03-18 07:05:58 +00:00