-
Notifications
You must be signed in to change notification settings - Fork 209
Open
Description
Perhaps I'm beating the dead horse, in any case, I was curious to see what happens when I use YAML.to_json instead the standard JSON library. It seems the Psych version inserts incorrectly new lines into JSON, rendering it invalid:
[20] pry(#<DefaultWorld>)> s
=> {"apiVersion"=>"v1",
"displayName"=>"OpenShift 3 Demo",
"description"=>"This is the first demo project with OpenShift v3",
"kind"=>"ProjectRequest",
"metadata"=>{"name"=>"demmol5"}}
[25] pry(#<DefaultWorld>)> Kernel.puts YAML.to_json(s)
{"apiVersion": "v1", "displayName": "OpenShift 3 Demo", "description": "This is the
first demo project with OpenShift v3", "kind": "ProjectRequest", "metadata": {
"name": "demmol5"}}
=> nil
[26] pry(#<DefaultWorld>)> YAML::VERSION
=> "2.0.8"
You can see there is a new line inserted into the description value.
I'm switching to the standard JSON approach but thought it would be nice to be fixed and possibly save somebody the hassle.
Don't take me wrong, YAML is nice and using Psych for YAML all the time. Thanks a lot for the awesome lib.
marek22k
Metadata
Metadata
Assignees
Labels
No labels