JavaScript JSON Quiz

This JavaScript quiz checks the everyday use of JSON.stringify() and JSON.parse(). You will predict the JSON text for common values, see which values are dropped or changed, and spot invalid JSON.

Easy 10 questions ~5 minutes Pass at 80% Node.js 22

Choose a mode

Playing as a guest: sign in to keep your XP and streak.

Sample question

Question 1 of 10

What does this print?

console.log(JSON.stringify({ a: 1, b: "x" }));
Show the answer

B. {"a":1,"b":"x"} JSON.stringify() returns compact JSON text: keys in double quotes, numbers unquoted, no spaces. [object Object] is what String(obj) would give.

What this quiz covers

  • JSON.stringify() output for objects and arrays
  • What happens to undefined, functions, NaN and dates
  • JSON.parse() and the strict JSON syntax
  • Picking keys with a replacer and customizing with toJSON()
  • Circular references

Questions people ask

Do I need an account?

No. Anyone can play. Sign in to keep your XP, streak, badges and history.

Can I retake it?

Yes. Your best score is kept, and the questions and answers are shuffled each time.