3

我尝试解析 JSON 响应。

@response = ActiveSupport::JSON.decode(@data.body)

@回复:

{"response"=>[{"name"=>"Den", "other"=>[{"sex"=>"male"}]}]}

如何访问

@response['response']['name'] 

@response['response']['name']['sex']
4

1 回答 1

8
@response['response'][0]['name']

@response['response'][0]['other'][0]['sex']
于 2013-04-14T18:18:12.243 回答