{ "finally":[ { "Title":"John Doe", "Address": { "AddressLines":[ "The Place", "123 New Place", "London", "England" ], "Postpre":"NW7XXY" }, "Telephone":"0012345", "Email":"", "Latitude":51.5024472101345, "Longitude":-0.557585646554, "Easting":500623, "Northing":179647 } ]}解析此JSON的代码是:
public class mainData { public List<LocationData> finally; public String[] getLocationData() { return AddressLines; } public void setLocationData(List<LocationData> finally) { this.finally = finally; }}这是因为您的字符串始于
[当您使用Gson解析这种类型的Json时,然后您需要像在我的标签(
{"finally": your data})中一样给标签加上前缀。实际上,Gson尝试映射标签及其值,但是在您的情况下,您
[不包含Gson可以通过其映射的Label。



