Not Another Markup Language

Oct 6, 2025

I defined a subset of YAML that only requires a JSON parser (and a tiny conversion func).

If you ever thought, I want something like a simple YAML parser but man those YAML parsers are monstrous, read on.

The format is basically HTTP headers where all values are JSON:

template: "home"
page_classes: ["page--jumbo"]
cta: {
    "primary": {
      "title": "Click me",
      "href": "http://example.com/"
    }
  }

Syntax:

  1. Each non-empty line is a key: value pair.
  2. Each value is a valid JSON.
  3. You can continue a value on multiple lines by indenting all continuation lines (using spaces or tabs).
  4. # starts a comment if it’s the first non-whitespace character on the line.

That’s it.

This is valid YAML, and is trivial to convert into an actual JSON, so you can use all features of your stdlib JSON parser.

I wrote a simple converter for Go as andreyvit/naml that you should just copy into your project.

For bonus points, combine it with andreyvit/jsonfix to allow trailing commas in that inline JSON.

Like what you see?

Get these posts delivered to your inbox. Not every week, no; only when I have something useful to say.

Here's where I'm supposed to promise not to spam you. Seriously, does that even make any sense? Has it ever? Sometimes the way the world works is just bizarre. So lemme say, unsubscribing will be a breeze when you're finally fed up with me.

I want this to be a community, not just a newsletter, too, so you're verrrry welcome to reply to these emails.