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:
Use the stringify function
var j = { "name":"binchen" }; var j_json = JSON.stringify(j); console.log("j in json object format :", j_json);
Happy coding!!!