Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eliminate JSON.{parse,load,generate,dump} and def to_json #12783

Merged
merged 1 commit into from
Nov 6, 2013

Conversation

chancancode
Copy link
Member

JSON.{dump,generate} offered by the JSON gem is not compatiable with
Rails at the moment and can cause a lot of subtle bugs when passed
certain data structures. This changed all direct usage of the JSON gem
in internal Rails code to always go through AS::JSON.{decode,encode}.

We also shouldn't be implementing to_json most of the time, and
these occurances are replaced with an equivilent as_json
implementation to avoid problems down the road.

See 1 for all the juicy details.

/cc @jeremy

@jeremy
Copy link
Member

jeremy commented Nov 6, 2013

This changed all direct usage of the JSON gem in internal Rails code
to always go through AS::JSON.{decode,encode}.

Seeing #to_json instead of ActiveSupport::JSON.encode usage.

JSON.{dump,generate} offered by the JSON gem is not compatiable with
Rails at the moment and can cause a lot of subtle bugs when passed
certain data structures. This changed all direct usage of the JSON gem
in internal Rails code to always go through AS::JSON.{decode,encode}.

We also shouldn't be implementing `to_json` most of the time, and
these occurances are replaced with an equivilent `as_json`
implementation to avoid problems down the road.

See [1] for all the juicy details.

[1]: intridea/multi_json#138 (comment)
@chancancode
Copy link
Member Author

@jeremy, fixed

jeremy added a commit that referenced this pull request Nov 6, 2013
Eliminate `JSON.{parse,load,generate,dump}` and `def to_json`
@jeremy jeremy merged commit 0f5a36e into rails:master Nov 6, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants