Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Converting JavaScript Object to JSON

// JavaScript object
const jsonData = { "name": "John", "age": 22 };

// converting to JSON
const obj = JSON.stringify(jsonData);

// accessing the data
console.log(obj); // "{"name":"John","age":22}"
 
PREVIOUS NEXT
Tagged: #Converting #JavaScript #Object #JSON
ADD COMMENT
Topic
Name
2+4 =