我在我的rails应用程序中尝试渲染特定字段时遇到了麻烦,我的结构是这样的:
def index
taobao_hash = OpenTaobao.get(
:method => "taobao.tbk.item.get",
:fields => "num_iid,title,nick,pict_url,cid,price,type,delist_time,post_fee,score,volume",
:q => "snus",
:page_size => 1,
:sort => "_des",
)
h = JSON.parse(taobao_hash.to_json)
render json: h["tbk_item_get_response"]
end
这如何像json一样呈现我的整个请求
{
"results": {
"n_tbk_item": [
{
"nick": "恶毒对于",
"num_iid": 17707525948,
"pict_url": "http://img4.tbcdn.cn/tfscom/i2/TB1umhOHVXXXXa0aXXXXXXXXXXX_!!0-item_pic.jpg",
"title": "瑞典戒烟产品唇烟嚼烟经典款General Classic White Portion Snus",
"volume": 127
}
]
},
"total_results": 99,
"request_id": "1476rjvn5sc2g"
}
我如何仅在我的视图中呈现title
?我似乎只能呈现一切。