Convert Array To Json Object In Javascript Code Example
Example 1: js array to json
// Array to JSON:
const jsonString = JSON.stringify(yourArray);
// JSON to Object / Array
const yourData = JSON.parse(jsonString);
Example 2: Javascript object to JSON string
var person={"first_name":"Tony","last_name":"Hawk","age":31};
var personJSONString=JSON.stringify(person);
Comments
Post a Comment