C.W.K.
Stream
Lesson 08 of 08 · published

Picking the Right Format — A Decision Matrix

~12 min · interop, decision-matrix, summary

Level 0Plaintext
0 XP0/64 lessons0/12 achievements
0/100 XP to next level100 XP to go0% complete

The closer for the whole quest

You now know all four formats. The last skill is choosing well. The matrix below summarizes when each format wins.

Choose by audience and lifecycle

  • Markdown — when the primary audience is a human reader, and the document is long enough that prose matters.
  • JSON — when the primary audience is software, the medium is the network or storage, and machine round-trip is required.
  • YAML — when humans edit the file, the structure is deeply nested, and indentation discipline is acceptable.
  • TOML — when humans edit the file, the structure is shallow-to-medium, and clarity-per-line beats compactness.

Anti-patterns to avoid

  • JSON for human config — no comments, trailing-comma traps, deep nesting reads like alphabet soup.
  • YAML for the wire — slower to parse, indentation-sensitive across systems, security risks with unsafe parsers.
  • TOML for deeply nested data — table headers stack up; YAML or JSON wins past 4 levels.
  • Markdown for structured data alone — use front matter for the structure, body for prose. Don't try to encode tables-as-data in Markdown body alone.

The fluency you've earned

You read all four. You convert between them. You write JSON Schema once and validate everywhere. You spot the Norway problem at a glance, the trailing-comma trap, the YAML tab. You know when to reach for jq, when for yq, when for an MDX component. That is markup literacy.

Closing principle: formats are tools. The literacy is knowing which tool fits which job, and knowing how to translate when the wrong tool is in your hand. The four-format fluency you now carry will compound across every project — README, API spec, deploy manifest, build manifest, training data — for the rest of your career.

Code

Decision matrix·text
                       │ Comments │ Native │ Deep   │ Wire    │ Best primary use
                       │ allowed? │ dates? │ nesting│ format? │
──────────────────────┼──────────┼────────┼────────┼─────────┼──────────────────
  Markdown             │   yes    │   no   │   no   │   no    │ human prose +
  (with front matter)  │          │        │        │         │ structured meta
  JSON                 │   no     │   no   │  yes   │  YES    │ machine wire
                       │          │        │        │         │ format, APIs
  YAML                 │   yes    │  yes   │  YES   │ rarely  │ human config,
                       │          │        │        │         │ K8s, CI, Ansible
  TOML                 │   yes    │   YES  │ medium │   no    │ human config,
                       │          │        │        │         │ pyproject, Cargo
When in doubt — three quick filters·text
1. Who edits this most? 
   - human writing prose         → Markdown
   - human editing structure    → YAML or TOML
   - software                   → JSON (or JSONL for streams)

2. How nested?
   - 1-3 levels                  → TOML reads cleanest
   - 4+ levels                   → YAML beats TOML
   - varies                      → either, plus a typed config layer

3. Where does it travel?
   - to disk only                → format that humans prefer
   - across the network          → JSON
   - both                        → human format on disk, convert at boundary
Final exercise — apply to your own work·text
Pick three configs / data files in your current repo:
  - one currently in JSON
  - one currently in YAML
  - one currently in TOML (or that could be)

Ask for each:
  - Is the format right for its audience?
  - Does the schema live next to the data, or scattered in code?
  - Would conversion improve readability or break tooling?

This review takes 10 minutes per file and saves hours per quarter.

External links

Exercise

Audit one repo of yours. List every config / data file by format. For each, ask: is this format right for its audience? Mark anything that should change. Then change one — convert one wrong-format file to the right one and notice the diff in editing comfort. The final lesson of the quest is making the change real, not just understanding the matrix.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.