从json获取格式化数据

时间:2014-03-13 13:06:17

标签: ruby-on-rails json

这是我从控制器中的api获得的json响应。

[{"TId":"5","TType":"test","TLocation":"Boston","TDesc":"Time in Boston","TDate":"2014-03-10 15:54:44","TStatus":"Go","TRemarks":"None"},{"TId":"6","TType":"test","TLocation":"New York","TDesc":"Time in New York","TDate":"2014-03-10 16:48:39","TStatus":"Go","TRemarks":"None"}]

我想在单独的字段中显示这些数据:

TId:"value", TType:"value", TLocation:"value", TDesc:"value", TDate:"value", TStatus:"value", TRemarks:"value"

这就是我获得json的方式:

result = JSON.parse(open("https://myapi.com/test", {:ssl_verify_mode => OpenSSL::SSL::VERIFY_NONE, :http_basic_authentication=>['uname', 'upassword']}).read)

PS:OP是JSON的新手

0 个答案:

没有答案