Had to add spaces to JSON, it wouldn't display correctly otherwise.
Had to add spaces to JSON, it wouldn't display correctly otherwise.
Sorry, what do you mean? Add spaces in which command?
var jsonback = {};
jsonback ["__type"] = "Geopoint";
jsonback ["latitude"] = theLat;
jsonback ["longitude"] = theLng;
return JSON.stringify(jsonback);
I meant I had to add spaces to the JSON code only for formatting when replying here.
Try this:
code
var jsonback = {
"__type": "GeoPoint",
"latitude": 10.0,
"longitude": 20.0,
};
return jsonback;
/code
I'm facing similar problems while uploading to Parse. I've tried
var jsonback = {};
jsonback ["__type"] = "Geopoint";
jsonback ["latitude"] = lat;
jsonback ["longitude"] = long;
return JSON.stringify(jsonback);
AND
var jsonback = {
"__type": "GeoPoint",
"latitude": lat,
"longitude": long,
};
return jsonback;
I used alert(JSON.stringify(jsonback)) to see exactly what was getting generated and this is the output I got http://prntscr.com/16r8wm
It looks correct but I get a Bad Request error like this http://prntscr.com/16r93x
This is definitely due to geopoint as I'm able to successfully upload image without geolocation.
Any help will be appreciated.
Please Chrome's Dev Tools (or Firebug) and Network tab to see the exact error message returned from Parse.