Your example string "s" is neither valid JSON or YAML. For starters, the
"=>" token is not allowed in either. You can't use :value in JSON either.
You need to use the double quoted string "value"


On Mon, Jul 1, 2013 at 12:42 PM, Love U Ruby <lists / ruby-forum.com> wrote:

> The same with `YAML#load`
>
> require 'yaml'
>
> s = %q!{:value => [ {"a" => nil, "b" => nil, "c" => 0}]}!
> s # => "{:value => [ {\"a\" => nil, \"b\" => nil, \"c\" => 0}]}"
> YAML.load(s)
> # =>
> # ~>
> /home/kirti/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/psych.rb:205:in
> `parse': (<unknown>): did not find expected node content while parsing a
> flow node at line 1 column 2 (Psych::SyntaxError)
> # ~>  from
> /home/kirti/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/psych.rb:205:in
> `parse_stream'
> # ~>  from
> /home/kirti/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/psych.rb:153:in
> `parse'
> # ~>  from
> /home/kirti/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/psych.rb:129:in
> `load'
> # ~>  from -:5:in `<main>'
>
> --
> Posted via http://www.ruby-forum.com/.
>
>


-- 
Tony Arcieri