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:
One custom defined for this , until we do strange from stringify method
var j={"name":"binchen","class":"awesome"};
var dq='"';
var json="{";
var last=Object.keys(j).length;
var count=0;
for(x in j)
{
json += dq+x+dq+":"+dq+j[x]+dq;
count++;
if(count
OUTPUT
{"name":"binchen","class":"awesome"}
LIVE http://jsfiddle.net/mailmerohit5/y78zum6v/