JavaScript Object and JSON – Convertion from one to another



What is JSON and how to convert JavaScript object into JSON and from JSON to Object. In this tutorial, By calling JSON.parse() and JSON.stringify(), I’ll show you how.

To convert JavaScript object into JSON, let’s say we have an object called myObject, we call this method: JSON.stringify(myObject); then it will return a JSON text that represent that object. If we want to bring it back, we call: myObject = JSON.parse(jsonString); where jsonString is JSON string that returned by JSON.stringify().

loading...

Leave a Reply

Your email address will not be published. Required fields are marked *