All current browsers have native JSON support built in. So as long as you’re not dealing with prehistoric browsers like IE6/7 you can do it just as easily as that:
var j = {
"name": "binchen"
};
console.log(JSON.stringify(j));
More Related Contents:
- Count the recurrence of a word
- How Can i Change the style of my angularjs object?
- Converting an object to a string
- What is the difference between string primitives and String objects in JavaScript?
- Parse JSON String into a Particular Object Prototype in JavaScript
- Sum JavaScript object propertyA values with the same object propertyB in an array of objects
- String to object in JS
- Which characters are valid/invalid in a JSON key name?
- Convert object string to JSON
- How to get object length [duplicate]
- Sorting a JSON object in Javascript
- Merge keys array and values array into an object in JavaScript
- Does console.log invokes toString method of an object?
- How to access nested JSON data
- Javascript group objects by property [closed]
- JSON.stringify function
- How to parse JSON string in Typescript
- Reverse of JSON.stringify?
- How to write data to a JSON file using Javascript
- Encoding Javascript Object to Json string
- traversing through JSON string to inner levels using recursive function
- Get object property name as a string
- Is there any possibility to have JSON.stringify preserve functions?
- Multiple arguments vs. options object
- Why does String.prototype log it’s object like a standard object, while Array.prototype logs it’s object like a standard array?
- Push JSON Objects to array in localStorage
- Map HTML to JSON [closed]
- How to create a date object from string in javascript [duplicate]
- how to iterate over inner objects / property in an object
- JSON.stringify converting Infinity to null