What is JSON? — JS Technical Interview Questions & Answers
A lightweight text format for structured data.
What is JSON?
- JSON (intro) is a JS topic. In plain words you use it for let total = 0 in a cart script. Don’t start with a slogan — start with that picture.
- Smallest example: let for change, const for fixed. Type it, run it, and say what you see. If you can do that from memory, you know JSON (intro).
- From the example next to this theory: A lightweight text format for structured data.
- Trap: var leak / const reassign. Fix that before you talk about advanced JS.
- Viva: what is JSON (intro)? Then show let for change, const for fixed. Then name the trap.
Technical Interview Tip: What is JSON (intro)? Show this: let for change, const for fixed. Trap: var leak / const reassign.
Code Examples for What is JSON?
What is JSON? — working example
const user = { name: "Ada", skills: ["JS", "SQL"] };
const raw = JSON.stringify(user);
const back = JSON.parse(raw);
console.log(raw);
console.log(back.name, back.skills.length);
// fetch sketch (lab uses parse stand-in):
async function load() {
const data = JSON.parse('{"ok":true}');
return data.ok;
}
load().then(console.log);What is JSON? — jSON is text; stringify/parse convert to plain data. fetch() loads JSON from APIs in the browser/Node.
How to Explain What is JSON? to an Interviewer
What is JSON (intro)?
Used for let total = 0 a cart script Not just the heading
Give one small example of JSON (intro).
let for change, const for fixed A lightweight text format for structured data
What mistake do beginners make with JSON (intro)?
var leak / const reassign Show the fix
Where do you use JSON (intro)?
a cart script let total = 0