Thursday, March 12, 2015


JSON (JavaScript Object Notation) is a language that describes structured data.

It features:
  • Simple "atomic" data: numbers, strings, boolean, and a "null" value.
  • Arrays, i.e. sequences of successive values.
  • Dictionaries ("objects" in JSON parlance), which simply are bunches of values indexed by string keys.
That's all. And that's enough.

I fell in love with JSON a few years ago. The reasons are both functional and technical.

Functionally, JSON is the result of what XML failed to be: a simple data exchange format with a straightforward ecosystem (no DTD, schema, validation, tools over layers and layers of tools and libraries), no frivolities (e.g. no data vs. attribute wars).

Technically, the JSON parser is also very simple. Its grammar is a straightforward descending grammar with no rollbacks. It means that at each point in the JSON text, given the past and current letter, you know exactly what may follow. If it fails: syntax error, out.

Since I love that format I had to build my own parser library: YacJP. That library allows to read and write JSON data using any kind of UTF-8 character streams, including simple C strings, file descriptors, and POSIX files.

It was the first of a few projects that followed in the same "object-like" style.

There will be more to follow... stay tuned!