Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- % ruby yamlvjson.rb
- JSON to be parsed:
- {
- "items": [
- {
- "foo": ["bar", "baz"]
- }
- ]
- }
- JSON.parse:
- {"items"=>[{"foo"=>["bar", "baz"]}]}
- YAML.parse:
- #<YAML::Syck::Map:0xb7c8fa98>
- JSON to be parsed (NOTICE THE MISSING SPACE IN ["bar","baz"]):
- {
- "items": [
- {
- "foo": ["bar","baz"]
- }
- ]
- }
- JSON.parse:
- {"items"=>[{"foo"=>["bar", "baz"]}]}
- /usr/lib/ruby/1.8/yaml.rb:176:in `load': syntax error on line 3, col 25: ` "foo": ["bar","baz"]' (ArgumentError)
- from /usr/lib/ruby/1.8/yaml.rb:176:in `parse'
- from yamlvjson.rb:37
Add Comment
Please, Sign In to add comment