dimanche 10 janvier 2016

JSON with symbols and strings not readable

I have the following JSON:

{ :a => 1, "b" => "test" }

jsonObject[:b] does not give me any data, whereas for a JSON with all keys as strings,

{ "a" => 1, "b" => "test" }

it works fine:

jsonObject[:b] # => "test"

Is there a constraint against using a symbol and key in the same JSON object?




Aucun commentaire:

Enregistrer un commentaire