Loading Depth Study
Preparing your workspace
Parsing converts JSON text into an in-memory data structure, while serialization converts application data into JSON text.
Network responses and files often contain JSON as text. A program needs to parse that text before accessing its properties. When sending data to another system, the application may need to serialize an object into JSON text. In JavaScript, JSON.parse handles parsing and JSON.stringify handles serialization.
A frontend receives a JSON API response, parses it into data, modifies a form object, and serializes that object before sending it back to the API.
const jsonText = '{"name":"Aman","age":20}';
const user = JSON.parse(jsonText);
console.log(user.name);
const output = JSON.stringify(user);
console.log(output);Aman
{"name":"Aman","age":20}