If I defined an object in JS with:
var j={\"name\":\"binchen\"};
How can I convert the object to JSON? The output string should be:
if you want to get json properties value in string format use the following way
var i = {"x":1} var j = JSON.stringify(i.x); var k = JSON.stringify(i); console.log(j); "1" console.log(k); '{"x":1}'