如何打印/转换对象/嵌套哈希到字符串/ json?

时间:2013-08-11 23:04:08

标签: ruby json object hash type-conversion

FlickRaw lib返回“#< FlickRaw :: ResponseList:0x007fbe843a9ea0>”对象(如果我打印它),应用.to_hash方法后转换为哈希,我可以使用puts打印:

 {"id":"9490885638","secret":"4c05132e6a","server":"7293","farm":8,"dateuploaded":"1376261143",
"isfavorite":0,"license":"0","safety_level":"0","rotation":0,
"owner":"#<FlickRaw::Response:0x007fbe843a9ea0>",
"title":"stolen memories.","description":"Dresden, 2013.\nPlatz vor der Semperoper.",
"visibility":"#<FlickRaw::Response:0x007fbe843b1790>",
"dates":"#<FlickRaw::Response:0x007fbe843bb3a8>", ... }

那么如果我打印它(如果没有看到一些“#&lt; FlickRaw :: Response:0x007fbe843a9ea0&gt;”哈希),如何深度转换返回值以查看所有嵌套值/结构?

P.S。这些对我不起作用[Ruby Hash converted to JSON only shows object names]

0 个答案:

没有答案