Hello
I am storing some coordinates in a database, I do this using JSON.stringify method to convert an array of coords into a string. This works fine but when I try to reload the coords using JSON.parse() I don’t get the original coords back instead I get [object Object],[object Object].
here is the code.
<script type="text/javascript" src="json2.js"></script>
function save_route()
{
alert(path);
var str = JSON.stringify(path);
document.dataForm.routeMarkers.value = str;
alert(str);
}
this converts an array of coords eg (51.50439265195253, -3.3535325679687276),(51.53259269613245, -3.2134568843749776)
into
[{“Oa”:51.50439265195253,“Pa”:-3.3535325679687276},{“Oa”:51.53259269613245,“Pa”:-3.2134568843749776}]
function load_route(){
var loadStr = document.dataForm.routeMarkers.value;
alert(loadStr);
loadPath = JSON.parse(loadStr);
alert(loadPath);
}
when I try use this instead of getting the original coords back i get
[object Object],[object Object]
(the alerts are just to see what is going on)
Thanks for any help