9951 explained code solutions for 126 technologies


javascriptConvert object to JSON string


var obj = {a: 1, b: 2};
var json = JSON.stringify(obj);ctrl + c
var obj

test object to convert to JSON string

json

will contain resulting JSON string

JSON.stringify

converts object in arguments to JSON string