Hi everyone,
so we are using yajl for parsing JSON. However there are some reasons
why we might consider switching to another one:
1) It is basically dead upstream
2) We're just using the lexer part of it
3) We only use it for parsing
4) The are workarounds for it in the code
So I looked at some options and found few other libraries, I only took
those that are widely available (read: I checked if some random
downstream distro has them), however most of them were not very much
usable. Except one. But here's the list of few others that didn't look
that bad either. All are MIT-licensed, try to be thread-safe and
support pkg-config:
- libfastjson [1] - from rsyslog community, optimized for working with
logs, used almost only by rsyslog, it's supposed to
have doxygen docs, they switched to libfastjson
from json-c due to some problems with it
(performance, ref counting bug, ...)
- json-c [2] - looked abandoned until I looked at the proper github
page, "documentation" in doxygen
- Jansson [3] - I really like this one. The API seems very intuitive,
it has nice documentation [4] in readthedocs (and I'm
not talking about the visual style, but how easy is to
find information), it can be used for formatting JSON
in a similar way we are doing it. It has json_auto_t
(optional) type that uses the attribute cleanup for
automatic scope dereference (just in case we want to
use it), it has iterators... did I tell you I like this
one a lot?
What do you (others) think of switching the JSON library? Do you know
about any other projects that could be used considering license,
platform support, etc.? Also feel free to fix any mistakes I might have
posted. I double-checked it, but you know, "trust, but verify".
Have a nice day,
Martin
[1]
https://github.com/rsyslog/libfastjson
[2]
https://github.com/json-c/json-c
[3]
http://www.digip.org/jansson/
[4]
https://jansson.readthedocs.io/