There's often confusion around the difference between
obj = {"foo" : "bar"}
and
obj = {foo: "bar"}
The explanation is that using quotes follows proper JSON syntax, while no-quotes is just Javascript syntactic sugar. Now, my query is how to convert any unquoted or semi-quoted JavaScript object like:
semi = { "foo" : "bar", hello: "world"}
to a fully quoted object like:
fully = { "foo" : "bar", "hello": "world" }
using JavaScript. I'm not looking for JSON.stringify() as it would return a string; I need a regular JS object. Appreciate your help!