Allocators in json.h!

While at GDC I got a feature request from the awesome folks over at Blastbay Studios requesting that they could feed an allocator to json.h, my JSON parsing library. This has long been on my TODO list, so I took the opportunity of a plane ride back from San Francisco to the Isle of Skye to remedy the situation! The latest master version of json.h changes the signature of json_parse_ex to include two new fields:

git pre-commit clang-format hook

Most of my company projects have a requirement that we run clang-format on all commits to keep a consistent style. Unfortunately, I’m as forgetful as the fabled goldfish (which actually isn’t that forgetful it turns out) so I often forget to run clang-format. After the umpteenth time of forgetting and suffering some quite deepseated rage from my colleagues, I decided to investigate a way to automate the process. It turns out git has a really cool feature introduced in 1.

Full Simplified JSON support in json.h

In a previous post (Partial) Simplified JSON support in json.h I covered the partially added simplified JSON support I had added to json.h. One of the things I covered was my unwillingness to implement two of the features of simplified JSON, commas being optional and replacing : with =. I argued that both of these were unnecessary and stupid additions to the library. I was wrong. The immediate feedback I received detailed good reasons why these were useful, but more importantly - why did I half-arse implementing a feature that was requested by a user!

Introducing utest.h!

So as you may (or may not) already know - I’ve written two tiny C libraries - utf8.h and json.h. One of the questions that most plagued me when writing these libraries was ‘How should I write the tests for them?’ I could put them in a separate repository, I could put them within the repository, should I create a new testing framework every time? It would be useful to be able to have test cases spread across multiple files… and the thoughts went on and on.

(Partial) Simplified JSON support in json.h

With the help of the rather awesome @ocornut - I’ve managed to get a variant of simplified JSON support into json.h! So first off - what is simplified JSON? Taken straight from the Bitsquid blog; Assume an object definition at the root level (no need to surround entire file with { }) Commas are optional Quotes around object keys are optional if the keys are valid identifiers Replace : with = Of the four points above, I’m going to argue that only 1.