views:

341

answers:

2

I'm looking for recommendations for a reliable and functional cross-platform JSON library that can be called from either C or C++ and which can be used with Linux, Mac OS X and WIN32. Ideally it should support both generating JSON output as well as parsing JSON input.

I've looked at a lot of the open source options but it's hard to tell how mature, reliable and well-documented each of the various libraries are, so I'm really looking for individual recommendations from developers who have successfully used or at least evaluated one or more of the various options.

+2  A: 

I used JsonCpp.

Gregory Pakosz
Thanks for that - could you elaborate a little as to how useful/reliable you have found it to be ?
Paul R
I found it reliable and easier to integrate compared to JSON Spirit that relies on Boost. Not that I dislike Boost but for that pet project I didn't want to bother with it.
Gregory Pakosz
+1  A: 

wxWidgets comes with wxJson, a small implementation that can read and write JSON files. Not sure exactly what your needs are, but if you are writing something from scratch, maybe this is useful. I've used wxWidgets with OSX and Windows, and after the initial configuration pains, it ports very nicely.

cjcela
Thanks - will wxJson build on its own, do you know. or do you need to build the whole of wxWidgets ?
Paul R
wxJson is just 3 files. For what I know it should have dependencies to wxWidgets - but a minimum library build should be very light. I've had compiled GUI apps using wxWidgets that are about 300k, and that is using all sorts of goodies...
cjcela