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:
you can use native stringify function like this
const j={ "name": "binchen" } /** convert json to string */ const jsonString = JSON.stringify(j) console.log(jsonString) // {"name":"binchen"}