~/VibeHandbook
$39

Chapter 04 · 04

The data types you'll meet

Every value in JSON is one of a small set of types. Knowing them lets you spot when a value is the wrong kind — a frequent source of bugs.

  • string — text, always in double quotes: "Ada Lovelace", "[email protected]".
  • number — a plain number, no quotes: 42, 3.14. (Quotes change the meaning: "42" is the text four-two, not the number.)
  • booleantrue or false, no quotes. Used for yes/no flags like "isAdmin".
  • null — a deliberate "no value here." "avatarUrl": null means the user has no avatar — different from the key being missing entirely.
  • array — an ordered list: ["beta", "early-access"].
  • object — a bundle of key/value pairs: the "profile" block.

That's the whole vocabulary. The most common real-world mistake is the string-vs-number trap: code expects the number 42 but the API sends the string "42", and a comparison silently fails. When something behaves weirdly, checking the type of a value is often the fix.

Want it offline?

Get the PDF + EPUB + downloadable prompt library + version updates.

$ Get the PDF — $39