我在json格式的链接上有这个,我必须检索它
{"vehicles":[{"name":"motorcycle","wheels":2,"maxCapacity":2,"currentPassengers":1,"maxSpeed":"260 km/h"},{"name":"car","wheels":4,"maxCapacity":4,"currentPassengers":3,"maxSpeed":"220 km/h"},{"name":"aeroplane","wheels":18,"maxCapacity":416,"currentPassengers":215,"maxSpeed":"920 km/h"}]}
将其存储到常规javascript对象中。
答案 0 :(得分:1)
submitButt
然后您可以使用var obj = JSON.parse({"vehicles":[{"name":"motorcycle","wheels":2,"maxCapacity":2,"currentPassengers":1,"maxSpeed":"260 km/h"},{"name":"car","wheels":4,"maxCapacity":4,"currentPassengers":3,"maxSpeed":"220 km/h"},{"name":"aeroplane","wheels":18,"maxCapacity":416,"currentPassengers":215,"maxSpeed":"920 km/h"}]})
来访问车辆。