Open drbitboy opened 6 years ago
Hi Serge,
The Makefile changes are mostly to make the different steps consistent (e.g. example/simple.c build to executable simple_example, but example/jsondump.c used to build to exectuable jsondump (not to jsondump_example).
I also added another example based on some work I am doing for the OSIRIS-REx spacecraft mission to asteroid (101955) Bennu, that dumps the JSON primitives, plus array lenghts, with Javascript-like names. It would be somewhat inefficient, but those primitives could be put into a tree (e.g. avltree) with the JS-like names as keys, and the tree then used as a way to access primitives in the JSON. So in some ways it is similar to examples/simple.c, where the program knows the structure of the JSON beforehand and needs a way to navigate. In structure the new example is very similar to examples/jsondump.c, although I cleaned up the code that reads the file, and added a way to pass a filename instead of using only STDIN; I fully admit that "cleaned up" is a subjective term, of course, and some may find my code style a bit too dense and/or confusing (e.g. putting assignments inside while and if expressions).
Thanks for the great package.
Feel free of course to edit or reject the example, or this entire pull request, if you feel it does not add anything to the package.