DEV Community

LogicWiz Admin
LogicWiz Admin

Posted on Originally published at logicwiz.ai

Can you spot the AI's mistake? Try this 5-line JSON answer

Here is a short answer an AI wrote about JSON. Four lines are true and one is not. Decide which before you scroll.

What are the basic rules of JSON?

  1. JSON is a plain-text format for structured data, and most languages can read and write it.
  2. Object keys must be strings in double quotes, so {name: 1} is not valid JSON.
  3. Values can be strings, numbers, true, false, null, arrays or objects.
  4. You can add a comment on its own line with //, and parsers skip it like whitespace.
  5. A trailing comma after the last item, as in [1, 2,], is not allowed.

.

.

.

It is line 4. Standard JSON has no comments. RFC 8259 defines none, and JSON.parse throws on that line. Some tools accept comments as an extension, which is why the claim sounds fine.

The trap is line 5. It sounds like a fussy made-up rule, and it is true. Calling a correct line wrong is just as costly as missing the wrong one.

Why this is worth practising

A lot of the code and explanations we read now start as an AI draft. Producing an answer is only half the job. The other half is reading a fluent answer and catching the one sentence that would break production. Normal quizzes do not train that, because the question itself tells you something is being tested. Here the wrong line looks exactly like the right ones.

Three habits that help:

  • Read for the claim, not the tone. Every line sounds equally sure.
  • Distrust the convenient rule. Line 4 describes what we wish JSON allowed.
  • Say the reason to yourself first. If you cannot say why a line is wrong, you are guessing.

Want more rounds?

We turned this into a free five-minute game, Spot Aria's Mistake: five rounds, one wrong line in each, 20 seconds to tap it, then pick why it is wrong. Eight tracks, from Python and SQL to AI and DSA. There is a practice round that needs no sign-in: arena.logicwiz.ai.

Disclosure: I work on LogicWiz, which makes the game.

Originally published on LogicWiz.

Top comments (0)