I have this string:
var filePos = "{'Data':'17/02/2015', 'Descrizione':'PROVA AAA', 'Lat':'45.411258', 'Lng':'11.906326', 'Foto':'sdjahvas'}" +
"{'Data':'18/02/2015', 'Descrizione':'PROVA BAA', 'Lat':'45.411190', 'Lng':'11.906324', 'Foto':'asde'}";
I have to put in array some information like Data, Lat, Lng, Index(is progressive).
I use this function:
var jsonString = filePos.replace(/\'/g, '"').split('}'),
positionAry;
jsonString.pop();
positionAry = JSON.parse('[' + jsonString.join('},') + '}]');
beaches = positionAry.map(function (obj, index) {
return [obj.Data, obj.Lat, obj.Lng, index+1];
});
but the array that return is:
var beaches = [
["17/02/2015", "45.411158", "11.906326", 1],
["18/02/2015", "45.411190", "11.906324", 2],
];
So I don't want this array, but this:
var beaches = [
["17/02/2015", 45.411158, 11.906326, 1],
["18/02/2015", 45.411190, 11.906324, 2],
];
In short, i don't want Lat and Lng in inverted commas. How can i do that?
return [obj.Data, parseFloat(obj.Lat), parseFloat(obj.Lng), index+1];