2

given the following query:

{"ResultSet":{"version":"1.0","Error":0,"ErrorMessage":"No error","Locale":"us_US","Quality":40,"Found":1,"Results":[{"quality":40,"latitude":"37.777125","longitude":"-122.419644","offsetlat":"37.777125","offsetlon":"-122.419644","radius":10700,"name":"","line1":"","line2":"San Francisco, CA","line3":"","line4":"United States","house":"","street":"","xstreet":"","unittype":"","unit":"","postal":"","neighborhood":"","city":"San Francisco","county":"San Francisco County","state":"California","country":"United States","countrycode":"US","statecode":"CA","countycode":"","uzip":"94102","hash":"","woeid":2487956,"woetype":7}]}}

how do I get the "uzip"?

alert(data.ResultSet.Results) works but: alert(data.ResultSet.Results.uzip)
says 'undefined' and so does alert(data.ResultSet.Results[uzip]). thanks.

3 Answers 3

2

There's an array in there. Access it like so...

data.ResultSet.Results[0].uzip
Sign up to request clarification or add additional context in comments.

Comments

1

Try data.ResultSet.Results[0].zip

Note the Results array contains an object, you need to take the first element in the array, and then access the component within it.

Comments

1

How about data.ResultsSet.Results[0].uzip?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.