JSON, XML, YAML and Markdown Tutorial
Learn JSON, XML, YAML and Markdown step by step: 39 lessons in 9 chapters with examples, quizzes, diagrams and projects.
Start learning →
of lessons completed
Getting Started
- What Are Data Formats? Learn what a data format is, why programs need one, and how JSON, XML, YAML and Markdown differ, with the same record written four ways and run in your browser.
- Choosing the Right Format Compare JSON, XML, YAML, TOML, CSV and Markdown by readability, size, types, comments and tooling, and learn a simple checklist for picking the right one.
- Text Encoding and Syntax Basics Understand characters versus bytes, UTF-8, the byte order mark, escaping, line endings and whitespace rules, the basics that make JSON, XML and YAML parse correctly.
- Tools for Working with Data Formats A practical tour of the tools for data formats: editors and linters, command-line helpers like jq and xmllint, parser libraries by language, and how to build your own mini tools.
JSON in Depth
- JSON Syntax Learn the complete JSON grammar: objects, arrays, strings, numbers, booleans and null, the allowed whitespace, and the most common syntax mistakes, with live examples.
- JSON Types, Numbers and Dates See how JSON maps to language types, why floating-point and 64-bit integers cause bugs, how to store money, dates and binary data, and how to preserve precision.
- JSON.parse and JSON.stringify Master JSON.parse and JSON.stringify: error handling, pretty printing, what gets dropped, deep copies, circular references and safe parsing patterns with runnable examples.
- Replacers, Revivers and toJSON Customize JSON conversion in JavaScript with replacer functions, key allow-lists, reviver functions and toJSON methods, with practical examples for dates, secrets and classes.
- JSON Pitfalls and Variants Avoid common JSON mistakes, then meet its variants: JSON Lines for streams, JSONC and JSON5 for config files, and binary relatives like BSON and MessagePack.
JSON Schema
- JSON Schema: An Introduction Learn what JSON Schema is, why it beats hand-written checks, how a schema describes a document, and how to validate data with a runnable mini validator and clear error messages.
- JSON Schema Types and Constraints Constrain values with JSON Schema: type, enum, const, numeric ranges, string length, regular expression patterns and format, with a runnable validator and clear error output.
- JSON Schema for Objects and Arrays Describe nested objects and lists with JSON Schema: properties, required, additionalProperties, dependentRequired, items, prefixItems, uniqueItems and contains, with runnable examples.
- JSON Schema Composition, $ref and Conditionals Combine and reuse JSON Schemas with allOf, anyOf, oneOf, not, $ref, $defs and if/then/else, including discriminated unions and reusable definitions, with runnable examples.
XML, XPath and XSLT
- XML Syntax and Structure Learn XML from the start: elements, attributes, text, comments, CDATA, the declaration, well-formedness rules and the document tree, with a runnable mini parser.
- XML Namespaces, Entities and Processing Instructions Understand XML namespaces and prefixes, default namespaces, why namespace URIs matter, custom entities, processing instructions, xml:lang and xml:space, with runnable examples.
- Validating XML with DTD and XML Schema Learn how DTDs and XML Schema (XSD) define valid XML documents, with element declarations, complex types, occurrence rules, restrictions, and a runnable mini validator.
- XPath Basics Learn XPath to select elements, attributes and text from XML: path steps, descendants, predicates, wildcards, axes, functions and common patterns, with a runnable mini evaluator.
- XSLT Basics โ Transforming XML Learn XSLT, the XML transformation language: stylesheets, templates, apply-templates, for-each, value-of, sorting, conditions and output formats, with a runnable template-engine stand-in.
YAML and Config Files
- YAML Syntax Basics Learn YAML from scratch - indentation, key-value mappings, sequences, comments, scalar types and quoting - with a small runnable parser that shows how the text becomes data.
- Multi-line Text and Flow Style in YAML Learn YAML block scalars (| and >), chomping indicators, quoted multi-line strings, flow sequences and mappings, and when each style is the clearest choice.
- Anchors, Aliases, Tags and Documents in YAML Reuse YAML data with anchors, aliases and merge keys, force types with tags, and keep several documents in one file - with runnable models of how each feature resolves.
- YAML Gotchas - The Norway Problem and Other Pitfalls Learn the YAML pitfalls that break real files - the Norway problem, octal and sexagesimal numbers, version strings, duplicate keys, tabs - and how to write YAML that survives any parser.
- Configuration Files: Layers, Env Vars and Formats Learn how applications read configuration - choosing a format, .env and INI files, environment variables, deep merging and precedence from defaults to command-line flags - with runnable Node examples.
TOML, CSV and Other Formats
- TOML in Depth Learn TOML, the explicit configuration format - key/value pairs, strings, numbers, dates, arrays, tables, inline tables and arrays of tables - with a runnable subset parser in Node.
- CSV Parsing and Its Pitfalls Learn the CSV format and RFC 4180 rules - quoting, embedded commas and newlines, delimiters, BOM and encodings, type inference - and write a correct CSV parser and writer in Node.
- INI, .properties and Other Plain-Text Formats Learn the simple line-oriented data formats still found everywhere - INI, Java .properties, TSV, logfmt and fixed-width records - with parsers you can run and the pitfalls of each dialect.
- JSON Lines and Binary Formats Learn JSON Lines for streaming records and the binary alternatives MessagePack, CBOR, BSON and Protocol Buffers - how they encode data, what they save, and how to build a tiny encoder in Node.
Markdown and Documentation
- Markdown Syntax: The Complete Guide Learn all core Markdown syntax - headings, emphasis, lists, links, images, code, quotes, rules and HTML - with the CommonMark rules for edge cases and runnable Node examples.
- GitHub Flavored Markdown and Front Matter Learn GitHub Flavored Markdown extensions - tables, task lists, strikethrough, autolinks, alerts, footnotes - and YAML front matter, with parsers you can run in Node.
- Writing a Markdown-to-HTML Converter Build a small Markdown renderer step by step - escaping, block parsing, inline parsing, links and code spans - and learn why production parsers use a syntax tree and why escaping comes first.
- Documentation with Markdown Learn how to write and maintain project documentation in Markdown - README structure, changelogs, architecture decision records, docs as code, link checking and documentation linting - with runnable checks.
Parsing, Security and Tooling
- Writing a Tokenizer and Parser Learn how data-format parsers work by building a JSON tokenizer and recursive-descent parser in Node, with line and column errors, depth limits and tests against the built-in JSON.parse.
- Data Format Security Learn how data formats are attacked - prototype pollution, unsafe YAML loading, XXE and entity expansion, CSV formula injection, Markdown XSS, oversized input - and the defences that stop each one.
- Choosing a Format and Converting Between Them Compare JSON, XML, YAML, TOML, CSV and Markdown by purpose, then learn to convert between them safely - flattening nested data, mapping types, and spotting what each conversion loses.
- Command-Line Data Tools Learn the command-line tools for working with JSON, YAML, XML and CSV - jq, yq, xmllint, Miller, csvkit and linters - plus how queries and schema validation work, with runnable Node stand-ins.
Projects and Practice
- Project: A Layered Configuration Loader Build a complete configuration loader in Node - defaults, INI-style file, .env text, environment variables and command-line flags merged in order, validated against a schema, with provenance for every value.
- Project: A JSON Lines Log Analyser Build a streaming log analyser in Node - parse JSON Lines, skip bad lines, validate records, aggregate counts and percentiles, and publish the report as CSV, JSON and a Markdown table.
- Project: A Static Page Builder from Markdown Build a tiny static site generator in Node - read Markdown files with front matter, render HTML with heading anchors, create an index and navigation, validate links, and write finished pages.
- Practice: Data Format Exercises Practice YAML quoting, CSV statistics, JSON Lines deduplication, Markdown link extraction and flat-to-nested conversion with five worked exercises, hints, runnable solutions and self-tests.