Data Formats (JSON, YAML, TOML, XML, CSV)
Read, write, validate, query and convert JSON, YAML, TOML, XML and CSV, with what each parser really does shown by examples that run.
48 lessons: 48 free with Pro answers.
Examples run with Node.js 24.21.0, quickjs 0.32.0, Python 3.14.8, Pyodide 314.0.7, Ruby 4.0.7 and sql.js 1.14.2.
Continue: Choosing a data format: JSON, YAML, TOML, XML, CSV
Who it is for
Developers, testers, data and DevOps engineers and students who read, write, validate, query, transform or secure JSON, YAML, TOML, XML and CSV.
What you will be able to do
- Choose a data format for a job, and read and write its text with the right encoding, byte-order mark and line endings
- Parse and write JSON in JavaScript and Python without losing numbers, keys, dates or types
- Validate documents with JSON Schema 2020-12 and query them with JSONPath, jq, JMESPath and SQL
- Write YAML and TOML configuration that every parser reads the same way, and load it safely
- Parse XML safely, use namespaces and schemas, and query and transform it with XPath, XSLT and XQuery
- Read and write real-world CSV, including spreadsheet exports, and keep exports safe from formula injection
- Convert, stream and evolve data across formats, and compare text formats with binary ones
- Lint, format and diff data files in CI, and answer data-format questions in interviews and reviews
Revise and practise
- Practice: every exercise and quiz (51 exercises, 48 quizzes)
- Data Formats (JSON, YAML, TOML, XML, CSV) flashcards
Modules and lessons
What the labels mean
- Free lesson, Pro answers
- the whole lesson is free; the model answers to its interview questions open with a pass
- Pro
- opens with a Pro, Premium or Ultimate pass
Minutes are reading time.
What a pass opens in this track
97 interview answers. The same pass opens every other track and every Pro tool.
- Module 1
Foundations: choosing formats and handling text
What separates JSON, YAML, TOML, XML and CSV, which job each fits and which specification governs it, and how to read their text safely: encodings, byte-order marks and line endings.
- Choosing a data format: JSON, YAML, TOML, XML, CSV Free lesson, Pro answers: 20 minutes
- UTF-8, BOMs and line endings in data files Free lesson, Pro answers: 15 minutes
- Module 2
JSON in depth
The JSON grammar and data model, parsing and writing it in JavaScript and Python, numbers and precision, interoperability traps, variants, JSON Pointer and Patch, and canonical JSON.
- JSON syntax and data model (RFC 8259) Free lesson, Pro answers: 15 minutes
- Parse and serialise JSON in JS and Python Free lesson, Pro answers: 15 minutes
- Numbers: precision, big integers and decimals Free lesson, Pro answers: 15 minutes
- JSON interop: duplicates, key order, I-JSON Free lesson, Pro answers: 15 minutes
- JSON Lines, JSONC, JSON5 and other variants Free lesson, Pro answers: 20 minutes
- JSON Pointer, JSON Patch and Merge Patch Free lesson, Pro answers: 20 minutes
- Canonical JSON (RFC 8785) and signatures Free lesson, Pro answers: 15 minutes
- Module 3
JSON Schema 2020-12
A first schema, objects and arrays, composition and conditionals, $ref and reuse, formats and vocabularies, and how drafts, OpenAPI and generated code relate.
- Your first JSON Schema 2020-12 Free lesson, Pro answers: 20 minutes
- Objects and arrays in JSON Schema Free lesson, Pro answers: 20 minutes
- Composition and conditionals in JSON Schema Free lesson, Pro answers: 15 minutes
- JSON Schema $ref, $defs, $id and $dynamicRef Free lesson, Pro answers: 15 minutes
- JSON Schema formats, vocabularies and validators Free lesson, Pro answers: 15 minutes
- Drafts, OpenAPI and code from JSON Schema Free lesson, Pro answers: 15 minutes
- Module 4
Querying JSON: JSONPath, jq, JMESPath and SQL
JSONPath (RFC 9535) selectors, filters and functions, and the same questions asked with jq, JMESPath and the JSON functions of SQL.
- JSONPath (RFC 9535): selectors and segments Free lesson, Pro answers: 25 minutes
- JSONPath filters, comparisons and functions Free lesson, Pro answers: 20 minutes
- jq, JMESPath and SQL JSON paths compared Free lesson, Pro answers: 25 minutes
- Module 5
YAML 1.2 and its traps
Mappings, sequences and scalars, block scalars, tags and schemas, the type-coercion traps, anchors and merge keys, and loading and editing YAML safely.
- YAML essentials: mappings, sequences, scalars Free lesson, Pro answers: 15 minutes
- Multi-line strings: YAML block scalars Free lesson, Pro answers: 15 minutes
- YAML tags and schemas: failsafe, JSON, core Free lesson, Pro answers: 15 minutes
- YAML type traps: Norway, octal, sexagesimal Free lesson, Pro answers: 15 minutes
- YAML anchors, aliases and merge keys Free lesson, Pro answers: 15 minutes
- Safe YAML loading and comment-safe edits Free lesson, Pro answers: 15 minutes
- Module 6
TOML 1.1 and other configuration formats
TOML tables and arrays of tables, what TOML 1.1 changed and where parsers differ, pyproject.toml and Cargo.toml, and INI, .env and HCL.
- TOML essentials: tables and arrays of tables Free lesson, Pro answers: 15 minutes
- TOML 1.1, dates, integers and parsers Free lesson, Pro answers: 20 minutes
- TOML in practice: pyproject.toml and Cargo.toml Free lesson, Pro answers: 15 minutes
- Other config formats: INI, .env and HCL Free lesson, Pro answers: 15 minutes
- Module 7
XML 1.0: syntax, namespaces, parsing, security, schemas and signatures
Well-formed XML, namespaces, tree and streaming parsers, parsing with external entities off, XSD validation, XML you meet every day, and canonical XML with signatures.
- XML syntax and well-formedness Free lesson, Pro answers: 20 minutes
- XML namespaces without confusion Free lesson, Pro answers: 15 minutes
- Parsing XML: trees, events and streaming Free lesson, Pro answers: 20 minutes
- Safe XML parsing: external entities off Free lesson, Pro answers: 15 minutes
- Validating XML with XSD 1.0 and 1.1 Free lesson, Pro answers: 25 minutes
- XML you meet daily: sitemaps, feeds, SVG, OOXML Free lesson, Pro answers: 25 minutes
- XML canonicalisation and digital signatures Free lesson, Pro answers: 20 minutes
- Module 8
XPath, XSLT and XQuery
XPath paths, axes and predicates, XPath 3.1 maps and arrays, XSLT templates and the identity transform, XSLT 3.0 and JSON output, and XQuery FLWOR expressions.
- XPath 1.0: paths, axes and predicates Free lesson, Pro answers: 25 minutes
- XSLT fundamentals: templates and identity Free lesson, Pro answers: 20 minutes
- Module 9
CSV and tabular text
CSV by RFC 4180 and its dialects, messy real-world files and spreadsheet exports, formula injection in exports, and typed CSV with CSVW and Table Schema.
- CSV by the book: RFC 4180 and dialects Free lesson, Pro answers: 20 minutes
- Messy CSV: Excel, encodings and Indian formats Free lesson, Pro answers: 20 minutes India-specific
- Safe CSV exports and formula injection Free lesson, Pro answers: 15 minutes
- Typed CSV: CSVW metadata and Table Schema Free lesson, Pro answers: 20 minutes
- Module 10
Across formats: time, conversion, streaming, evolution, binary
Dates and times in every format, converting without losing data, streaming files too large for memory, changing a format safely, and binary formats such as CBOR and Parquet.
- Dates and times across data formats Free lesson, Pro answers: 20 minutes
- Converting between formats without losing data Free lesson, Pro answers: 20 minutes
- Streaming large JSON, XML and CSV files Free lesson, Pro answers: 15 minutes
- Schema evolution: change formats safely Free lesson, Pro answers: 15 minutes
- Beyond text: CBOR, MessagePack, Protobuf, Parquet Free lesson, Pro answers: 15 minutes
- Module 11
Tooling, reviews and interviews
Linting, formatting and diffing data files in CI, and the data-format questions that come up in interviews and code reviews, answered in full.
- Lint, format and diff data files in CI Free lesson, Pro answers: 30 minutes
- Data-format questions for interviews and reviews Free lesson, Pro answers: 20 minutes
Related tools
Official documentation
- RFC 8259: The JavaScript Object Notation (JSON) Data Interchange Format (IETF)
- JSON Schema specification (JSON Schema)
- YAML Ain't Markup Language (YAML) version 1.2.2 (YAML Language Development Team)
- TOML v1.1.0 (TOML)
- Extensible Markup Language (XML) 1.0 (Fifth Edition) (W3C)
- RFC 4180: Common Format and MIME Type for Comma-Separated Values (CSV) Files (IETF)