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:
For debugging in Node JS you can use util.inspect(). It works better with circular references.
var util = require('util'); var j = {name: "binchen"}; console.log(util.inspect(j));