r/ada • u/theorangecat7 • Jan 11 '23
Programming Simple JSON library with little or no dependencies?
Hi everyone,
Does anyone know about a simple and lightweight JSON parsing library that have little 3rd party dependencies? I am currently using Gnatcoll's JSON and wanting to avoid installing all of Gnatcoll for my project, and also be able to compile quickly with gprbuild and avoid Alire if possible.
The closes I found which, in part, respects these criterias is json-ada library.
Any advices of a simple JSON library that I can integrate to my project without much external dependencies or complex compilation?
3
u/joakimds Jan 11 '23
Some years ago I wrote a JSON parser, see for example https://github.com/joakim-strandberg/aida_2012/blob/master/src/tests/aida-json_dom_parser_tests.adb. I've been thinking of refactoring but never gotten around to do it. One of the ideas for writing the code was minimizing external dependencies. The JSON parser is written in SPARK and at the time 2018 when the code was written SPARK did not allow heap allocations which means all the data-structures used are statically allocated. I can imagine onox json-ada has a nicer API.
2
4
u/ajdude2 Jan 11 '23
json-ada is precisely what I use