Psych.to_json generate incorrect JSON
Psych.to_json could be presumed to return JSON because of its name.
But Psych.to_json generate single-quoted string. It isn't valid JSON format.
=> "['a', 'b', 'c']\n"
JSON::ParserError: 376: unexpected token at ''a', 'b', 'c']
Updated by Anonymous over 9 years ago
- Status changed from Assigned to Closed
- % Done changed from 0 to 100
This issue was solved with changeset r30587.
Tomoyuki, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
- ext/psych/lib/psych/visitors/json_tree.rb (visit_String): JSON strings should be dumped with double quotes. [ruby-core:34186]
- test/psych/test_json_tree.rb: test for double quotes =end