I have results from a Google Geocoder request and I need a value form them to go into another array as follows:
var data = {};
Array.each(results, function(loc)
{
data.['value'] = loc.formatted_address;
}
I need data to then contain this structure:
data = [
{value: 'location one'},
{value: 'location two'},
{value: 'location three'}
];
An example of the JSON results from the query here:
http://maps.googleapis.com/maps/api/geocode/json?address=new%20york&sensor=false
In the case of the example query above the output I want is:
data = [
{value: 'New York, NY, USA'},
{value: 'Manhattan, New York, NY, USA'}
];
Im quite confused about what needs to happen in the Array.each function.
Any help would be great, thanks.