libnanjson is a software library that helps other programs to process JSON data. That means, if you are a developer, you can rely on libnanjson to process JSON in your programs rather than doing it yourself. If you are a regular computer user, probably you don't have to deal with libnanjson directly. The programs you use and the operating system will take care of everything.
I hope JSON will replace XML files in non-Web programs also. For instance, desktop applications can use JSON instead of XML to store configuration files. This will make them more user-friendly. And in such a situation, libnanjson can serve your application.
Certainly not. json.org already lists around 200 JSON processing libraries, among which 16 are C bindings (as of 17 May 2018).
I developed libnanjson to meet my requirements, and I think there will be more developers who'd like the way libnanjson perceives and does things.
For the second question, I can't give you a clear answer since I don't have sufficient experience with other JSON libraries.
No, I wrote it from scratch. I've reused some code written for my C compiler (which is yet incomplete), and that was also written by myself entirely.
Just the standard C library, which means you can use it on any modern operating system with no additional installations.
Currently none. If you've developed one, please let me know.
You can use
ctypes to call libnanjson functions from Python, until a true Python binding for libnanjson comes. But for most basic applications, you won't be needing libnanjson in Python since it already provides a module named
As of now, the official libnanjson API is released in the form of C header files. The same can be used with C++ or any other compatible language.
You can link your Assembly program with libnanjson, where header files are not needed technically, but can be used to understand the size and order of the parameters.
You can develop your own libnanjson bindings for other languages. If you do so, please let me know so that I can list it here.
Yes, by default. You can turn it off by using
Not by default. But you can turn it on by using
No, unless you embed them as regular JSON members. I've started working on flags to enable the optional support for comments, but it remains unimplemented as of 17 May 2018. Moreover, it is not of high priority since the JSON standard doesn't support comments.
libnanjson has full support for UTF-8 encoding, UTF-16 escape sequences (\uXXXX) and UTF-16 surrogate pairs. Some examples are given below. Please note that you'll be needing Unicode Emoji fonts to display one of them correctly.
|A||Latin Capital Letter A (ASCII/UTF-8)|
|\u0041||Latin Capital Letter A (ASCII/UTF-8-encoded UTF-16 Escape Sequence)|
|😊||U+1F60A Smiling Face With Smiling Eyes (ASCII/UTF-8-encoded)|
|\uD83D\uDE0A||U+1F60A Smiling Face With Smiling Eyes (ASCII/UTF-8-encoded UTF-16 Escape Sequence)|
NOTE: Although libnanjson supports UTF-16 escape sequences included in a string encoded in ASCII/UTF-8, it need not work with strings encoded in UTF-16.
Both of these features--callback and premature termination--will be useful, but remain unimplemented in libnanjson as of now. At present, you can iterate through the tokens after the whole data is tokenized, or iterate through the members after the whole token list is parsed. You can also make use of the search facility, again only after the whole data is parsed.
This model actually makes coding simple for you, and won't be resource-intensive in most practical cases. However, if you care about memory and time that much, and are dealing with extremely large files, you'll have to look for some other JSON library that supports these features.
Please note that there is a good chance I add these features soon.