I have issues with google places

Hey guys, question. I know this might not be the room but I'm curious if any of you know this.

I'm working with google places, when I query the autocomplete it gives me an "array" of this nature:
[country: "South Africa", administrative_area_level_1: "Western Cape", administrative_area_level_2: "Cape Town", locality: "Cape Town", postal_code: "7800", …]
When I try data.length on it however, it says 0. I mean, it looks and works like an object. I can do data.country and I get the value, but I can't do data[0], I get undefined....when I do Array.isArray(data) I get true....

What is this called? I would like to read up on it?

Thanks
You already invited:

Felix

Upvotes from:

 that is 1 not well formed. it looks like an array of objects with out enclosed {} for each object. and that really isn't an array because arrays can't parse ":" it kinda looks JSONish but again the array [] is not well formed
@kopahead for example [country:"South Africa", administrative_area_level_1: "Western Cape",..] should be [{country:"South Africa", administrative_area_level_1: "Western Cape"},..]
Each property is a member of an object
Either way you shouldn't be fiddling around with the response or have to rebuild the response. Your better off interating over the returned data and manipulate the iterated object
*iterating over the returned data I meant to say
var response=[ { "country": "South Africa", "administrative_area_level_1": "Western Cape", "administrative_area_level_2": "Cape Town", "locality": "Cape Town", "postal_code": "7800" } ]; var count=response.length; console.write(count);
would give you // 1

If you wanna answer this question please Login or Register