我试图迭代这个Json数据我希望得到的项目是"我试过的数据
@Response =HTTParty.get(("http://ddragon.leagueoflegends.com/cdn/5.15.1/data/en_US/item.json"))
puts @Response["data"].each do |item|
puts item
end
此外,我希望能够在不必知道IDS之前迭代它们,例如第一项是" 1001"我不想手动输入
但这只是说它找不到任何与' []'对于Nil:NilClass 在任何人提到下面的JSON之前还没有完成,因为我只拿了一个样本,还有更多的项目,如果我要粘贴它,它很容易超过1000行。
"type":"item",
"version":"5.15.1",
"basic":{},
"data":{
"1001":{
"name":"Boots of Speed",
"group":"BootsNormal",
"description":"<groupLimit>Limited to 1.</groupLimit><br><br> <unique>UNIQUE Passive - Enhanced Movement:</unique> +25 Movement Speed<br><br> <i>(Unique Passives with the same name don't stack.)</i>",
"colloq":";",
"plaintext":"Slightly increases Movement Speed",
"into":[
"3006",
"3047",
"3020",
"3158",
"3111",
"3117",
"3009"
],
"image":{
"full":"1001.png",
"sprite":"item0.png",
"group":"item",
"x":0,
"y":0,
"w":48,
"h":48
},
"gold":{
"base":325,
"purchasable":true,
"total":325,
"sell":227
},
"tags":[
"Boots"
],
"stats":{
"FlatMovementSpeedMod":25.0
}
},
"1004":{
"name":"Faerie Charm",
"description":"<stats><mana>+25% Base Mana Regen </mana></stats>",
"colloq":";",
"plaintext":"Slightly increases Mana Regen",
"into":[
"3028",
"3070",
"3073",
"3114"
],
"image":{
"full":"1004.png",
"sprite":"item0.png",
"group":"item",
"x":48,
"y":0,
"w":48,
"h":48
},
"gold":{
"base":180,
"purchasable":true,
"total":180,
"sell":126
},
"tags":[
"ManaRegen"
],
"stats":{
}
},