How can I extend / implement a toString for my custom parse object?
Say for example I have a Parse object that contains "name" and "distance" fields.
var NearBy = Parse.Object.extend("NearBy");
new Parse.Query(NearBy).first().then(function(nearby) {
nearby.get("name") // = maxim
nearby.get("distance") // = 3
})
I would like JSON.stringify(nearby) to output { "name" : "maxim", "distance" : 3" }, instead it dumps "[object Object]"
Can that be fixed ?
console.log(typeof nearby)? I suspectnearbyis already a string. Tryconsole.log(nearby)too.I would like JSON.stringify(nearby) to outputwhere in your code would you like the to be the case?toStringonnearby