Livio Brunner Livio Brunner - 1 year ago 60
JSON Question

Add quotation marks to JSON Object attributes

How do I add quotation marks to a JSON Object Attributes for example like this

{name:"User 01"}

so it should look like that afterwards

{"name":"User 01"}

(both of them are strings)

Answer Source
JSON.stringify(eval('{name:"User 01"}'));

Not really great but works.