Estoy en Rails 2.3 y estoy tratando de convertir una cadena que tiene formato JSON a un hash de Rails. Sin embargo, cuando uso JSON.parse
consigo una cadena JSON sin los delimitadores:JSON String to Rails hash
{"source_id":40007,"object":"86088947610496.1","coursewalk_id":"86088947610477.1","description":"","image_uri":"db\/db-files\/
Image_2011-09-24_14.37.37__0000.jpg","latitude":"38.0113439821061","letter":"","letter_A":"","letter_B":"","letter_C":"","lett
er_D":"","letter_E":"","letter_F":"","longitude":"-78.7576854509104","number":"1","mcw_id":71}
Resultados de JSON.parse
:
number1letter_Bcoursewalk_id86088947610477.1letter_Clatitude38.0113439821061letter_Dletter_Eletter_Fmcw_id71longitude-78.75768
54509104letterdescriptionobject86088947610496.1source_id40007letter_Aimage_uridb/db-files/Image_2011-09-24_14.37.37__0000.jpg
Código:
puts string_to_parse
fence_parsed = JSON.parse(string_to_parse)
puts fence_parsed
¿Alguna idea?
Gracias, Nick
¿Podría verificar la clase de la variable fence_parsed? "puts fence_parsed.class" –