Move json parser to nlohmann
We've been using boost::ptree
to parse json, mostly because that was what we had in Athena when we started. Since then we've added nlohmann
as an external dependency in all the builds. It has a few advantages:
- It's specifically a json parser, which makes for less awkward syntax than
ptree
(which is more of a tree parser that happens to work for json and several other file formats), - Supposedly it's quite a bit more memory and CPU efficient (not that it matters for us),
- It's internally type safe. This is in contrast to
ptree
which stores everything internally as a string.
The last point is the biggest driver for me: it would be nice to have a short script that dumped the merged json files, so people can verify that they are as expected, but the ptree
representation will turn everything into strings, meaning what you dump won't be what we put in. Beyond that, having a simple is_object()
and is_array()
function would make the fragment merging less awkward.
I suspect most of the conversion will be fairly mechanical, the part that might be tricky is the fragment merging, which gets a bit more into the guts of the data structure than the simple accessors we use elsewhere.