- A common use of JSON is to exchange data to/from a web server
- When sending data to a web server, the data has to be a string
- Convert a JavaScript object into a string with JSON.stringify()
console.log("*** Convert JSON object to a string"); var obj={ firstName:"Prathap", lastName:"Kudupu" } console.log('\n obj', obj) console.log('Convert JSON object to string',JSON.stringify(obj));
Output
Note: The difference between string and object is that the property name is the object is not a string
No comments:
Post a Comment