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>