JSON format of object

JSON format of object

<script>

      let student = {

        name: “shairy”,

        age: 30,

        isAdmin: false,

        courses: [“html”, “css”, “js”],

        wife: null,

      };

      let json = JSON.stringify(student);

      alert(typeof json); // we’ve got a string!

      alert(json);

      let jobj = JSON.parse(json);

      alert(jobj.name);

</script>

Post Your Comments & Reviews

Your email address will not be published. Required fields are marked *

*

*