Answers for "change json to object"

PHP
12

javascript parse json

const json = '{ "fruit": "pineapple", "fingers": 10 }';
const obj = JSON.parse(json);
console.log(obj.fruit, obj.fingers);
Posted by: Guest on May-20-2020
0

change to json string

var obj =
  { name: "John", today: new Date(), city : "New York" };

  var myJSON = JSON.stringify(obj);

  
document.getElementById("demo").innerHTML = myJSON;
Posted by: Guest on May-27-2021

Browse Popular Code Answers by Language