简体   繁体   English

如何从JSON数据获取位置名称

[英]How can I get Location name from JSON Data

I'm trying to get Location name from a JSON data. 我正在尝试从JSON数据获取位置名称。 I did it with: 我这样做:

 var adsress = JSON.stringify(dataa.Response.ResourceSets.ResourceSet.Resources.Location.Address.AddressLine["#text"]);

but when I changed the location point I can't do the same since it shows: 但是,当我更改位置点时,由于显示了以下内容,所以我无法这样做:

Cannot get ['#text'] of null or undefined var 无法获得null或未定义var的['#text']

The result( JSON data ): 结果(JSON数据):

 "Resources":{"Location":[{"Name":{"#text":"Rue Ibnou Battouta, Agadir, Morocco"}

http://jsfiddle.net/hJVjf/ http://jsfiddle.net/hJVjf/

data.Response.ResourceSets.ResourceSet.Resources.Location is an array. data.Response.ResourceSets.ResourceSet.Resources.Location是一个数组。

Try 尝试

 data.Response.ResourceSets.ResourceSet.Resources.Location[0].Address.AddressLine["#text"]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM