Interview Question

What is JSON?

JSON is data text, not a JavaScript object literal or executable code.

💡 Concept ✅ Quick Revision ⚡ JavaScript

Answer

JSON is a text format for serializing structured data. • JSON supports objects, arrays, strings, numbers, booleans, and null. • It does not directly represent undefined, functions, symbols, BigInt, or cyclic references. • JSON.parse reads JSON text and JSON.stringify creates JSON text from supported values.

Example

Code
const text = '{"name":"Maya"}';
console.log(JSON.parse(text).name);
Output
Maya

Quick Revision

JSON is data text, not a JavaScript object literal or executable code.