Silly question, but I'm unable to figure out..
I tried the following in Ruby:
irb(main):020:0> JSON.load('[1,2,3]').class
=> Array
This seems to work. While neither
JSON.load('1').class
nor this
JSON.load('{1}').class
works. Any ideas?
I'd ask the guys who programmed the library. AFAIK, 1
isn't a valid JSON object, and neither is {1}
but 1
is what the library itself generates for the fixnum 1.
You'd need to do: {"number" : 1}
to be valid json. The bug is that
a != JSON.parse(JSON.generate(a))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With