Answers for "convert json stringify data to array"

4

convert json.stringify to array in javascript

const myObj = {
  name: 'Skip',
  age: 2,
  favoriteFood: 'Steak'
};

const myObjStr = JSON.stringify(myObj);

console.log(myObjStr);
// "{"name":"Skip","age":2,"favoriteFood":"Steak"}"

console.log(JSON.parse(myObjStr));
// Object {name:"Skip",age:2,favoriteFood:"Steak"}
Posted by: Guest on May-21-2020
1

Convert json to array

var j = {0: "Hello", 1: " ", 2: "World", 3: "!"};

console.log(Object.values(j))
// Object.values(j) = ["Hello"," ","World","!"]
Posted by: Guest on June-15-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language