You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Upon further investigation, it seems the scalar types for attributes are not marked as quoted. Even if they are not marked as quoted, should we still quote the values since all keys need to be quoted in JSON? (corresponding code https://github.com/ruby/psych/blob/master/lib/psych/json/yaml_events.rb#L21)
The text was updated successfully, but these errors were encountered:
Steps to reproduce
I have created an executable test for this bug: https://gist.github.com/ianks/ba1f7175754780168c2a6618f13c95ec
I did not know whether to report this to Psych or Rails, just let me know if it belongs elsewhere and I will move the issue.
Expected behavior
Psych.to_json should emit valid JSON. Currently, not all keys are double-quoted; which although valid in JS, is not valid JSON.
Actual behavior
It emits invalid json, which can be seen in this example:
System configuration
Rails version: 5.0.0
Ruby version: 2.3.1
Notes
Upon further investigation, it seems the scalar types for attributes are not marked as quoted. Even if they are not marked as quoted, should we still quote the values since all keys need to be quoted in JSON? (corresponding code https://github.com/ruby/psych/blob/master/lib/psych/json/yaml_events.rb#L21)
The text was updated successfully, but these errors were encountered: