Mastering JSON Manipulation in JavaScript: A Guide to JSON.stringify() and JSON.parse() Functions

Описание к видео Mastering JSON Manipulation in JavaScript: A Guide to JSON.stringify() and JSON.parse() Functions

In this comprehensive tutorial, dive deep into the world of JSON manipulation in JavaScript as we explore the powerful JSON.stringify() and JSON.parse() functions. Whether you're a beginner or an experienced developer, this video will walk you through everything you need to know to effectively work with JSON data in your JavaScript projects. Learn how to serialize JavaScript objects into JSON strings using JSON.stringify() and deserialize JSON strings back into JavaScript objects using JSON.parse(). With practical examples and clear explanations, you'll gain a solid understanding of these essential functions and how to leverage them to streamline your code and enhance your web applications. Watch now and take your JSON handling skills to the next level!


///------------here sample code ----------------------

// JSON.stringify
// JSON.parse

// const json = {
// "name":"krisha",
// "age": 20,
// "sub" : {
// "sub1": "Math",
// "sub2": "english",

// },

// "dob": new Date(),
// }

// const jsonStr = JSON.stringify(json);
// console.log(typeof jsonStr)
// const pearsed_data = JSON.parse(jsonStr)
// console.log(typeof pearsed_data)

// // localStorage.setItem("data", ));
// // const data = localStorage.getItem("data");
// // console.log(JSON.parse(data))

// JSON.stringify
// JSON.parse


var num = 30;
var arra = [2,3,4,5,6];

var boolean = true;
var obj = {name: "krishna"}

const originalData = new Date();

console.log("Orignal :: ", originalData)
console.log(typeof originalData)

const jsonSting = JSON.stringify(originalData);

console.log("JONST STING AFTER USED STRINGIFY :: ", jsonSting)
console.log(typeof jsonSting)

const parsedData = JSON.parse(jsonSting); // return orignaData

console.log("JONS parsedData AFTER USED parse :: ", parsedData)
console.log(typeof parsedData)

console.log(
new Date(parsedData))

Комментарии

Информация по комментариям в разработке