Skip to solution
easyPhone Screen

What is JSON and why is it commonly used?

167 views
01

Understand the problem

Question presented to candidate: "What is JSON, and why do you think it became the default format for APIs and config files instead of just sending native language objects?"

What a strong answer should cover:

  • JSON (JavaScript Object Notation) is a lightweight, text-based data format for exchanging structured data, and despite the name it is language-independent -- Python, Java, Go, and every other mainstream language can read and write it.
  • JSON supports exactly six kinds of values: objects, arrays, strings, numbers, booleans, and null -- notably no functions, no undefined, no Date, no Map or Set, no BigInt.
  • JSON.stringify() serializes a JS value into a JSON string; JSON.parse() does the reverse; both accept an optional second argument (a replacer function/array, or a reviver function) for filtering or transforming values during the conversion.
  • JSON is stricter than a JavaScript object literal -- unquoted keys and trailing commas are both syntax errors to JSON.parse(), even though they would be perfectly valid inside real JS source code.
  • Real lossy edges worth naming unprompted: functions and undefined properties are dropped, Date becomes a plain ISO string (not restored as a Date on parse), Map and Set serialize to an empty object, BigInt throws, and a circular reference throws a TypeError.

Clarifying questions expected:

  • "Do you want me to also cover structuredClone as a modern alternative for deep cloning, or keep this focused on JSON itself?"

Code / implementation expected: Yes -- a short, runnable snippet demonstrating stringify/parse and the lossy edges.

jsondata formatapiweb
02

Attempt it yourself

Sketch your approach before reading the solution — that's what interviews test.

Nudge consolestandby

Stuck? Beam a request up — the console returns a conceptual nudge that guides your logic without spoiling the implementation.

03

Study the solution

Target Audience: Engineers preparing for JavaScript fundamentals and data-interchange interview questions. Difficulty: Easy

How to read this doc: Concepts are explained in plain language first, then tagged with 📌 Interview term:. Every result below was actually run on Node.js v24.19.0 — the

Solution ready — 2 min read

Classified // press E to declassify

04

Run the code

JSJSON.stringify/parse: the lossy edges, verified (run directly)
05

Join the discussion

Discussion (0)

Sign in to join the discussion.

No responses yet. Be the first to share what you think.

Transmission complete // awaiting log

KEEP THE
STREAK ALIVE.

Dossier 39 of 165 decoded in the JavaScript track. One more won't hurt.

Back to track