https://github.com/json-c/json-c is the official code repository for json-c. See the wiki for release tarballs for download.
C M4 Shell Makefile CMake HTML C++
Latest commit 82f5a4a Mar 4, 2017 @hawicz hawicz committed on GitHub Merge pull request #305 from alexanderst/master
Fix compilation without C-99 option
Permalink
Failed to load latest commit information.
autoconf-archive Fix a few places that needed adjustment for the size_t changes, inclu… May 23, 2016
tests Add a few more cases to test_parse to provide some examples of how pa… Feb 26, 2017
.editorconfig Adding a file for EditorConfig Aug 12, 2016
.gitignore Ignore tests/test_float Dec 18, 2016
.travis.yml Adding a test with cppcheck for Travis CI Aug 8, 2016
AUTHORS Add Jehiah and myself to the list of authors. Jun 14, 2011
Android.configure.mk Add an Android-friendly build system Apr 26, 2012
CMakeLists.txt vasprintf_compat.h: spin-off this compat header ; use math_compat.h a… Nov 22, 2016
COPYING Add my copyright. Jul 30, 2012
ChangeLog Copy over note about the 0.12.1 release to the master branch. Jun 7, 2016
Doxyfile Mention that we're aiming to follow RFC 7159 now. Jun 8, 2016
Makefile.am vasprintf_compat.h: spin-off this compat header ; use math_compat.h a… Nov 22, 2016
NEWS Improving README Aug 8, 2016
README Improving README Aug 8, 2016
README-WIN32.html Removes me as a maintainer, because I'm not. Sep 12, 2016
README.html Improving README Aug 8, 2016
README.md Note some minimum versions needed for autoconf, etc... Dec 13, 2016
RELEASE_CHECKLIST.txt Issue #113: add "new" files to appropriate variables in Makefile, and… Jun 27, 2016
STYLE.txt Add a brief style guide. Address Issue #257. Aug 9, 2016
appveyor.yml Appveyor: Visual Studio v140 no longer fails Nov 5, 2015
arraylist.c Issue #295: also check if size_t is the size of long long, to help su… Jan 8, 2017
arraylist.h Fix a few places that needed adjustment for the size_t changes, inclu… May 23, 2016
autogen.sh Use AX_APPEND_COMPILE_FLAGS() to check the various compile flags, suc… Oct 23, 2015
bits.h Move the json_min() and json_max() macros to json_util.h and mark eve… May 5, 2014
config.h.win32 Issue #205: use _strdup instead of strdup on Windows. May 23, 2016
configure.ac Issue #295: also check if size_t is the size of long long, to help su… Jan 8, 2017
debug.c Remove trailing whitespace Aug 26, 2014
debug.h Eliminate the deprecated mc_abort() function and MC_ABORT macro. Mar 23, 2014
json-c-uninstalled.pc.in Re-add the "json" pkg-config file as a compatibility shim. Jul 29, 2012
json-c.pc.in Very minor changes not related to C source code Aug 8, 2016
json-c.vcproj Revert "compat/strdup.h: move common compat check for strdup() to own… Nov 7, 2016
json-c.vcxproj vasprintf_compat.h: spin-off this compat header ; use math_compat.h a… Nov 22, 2016
json-c.vcxproj.filters vasprintf_compat.h: spin-off this compat header ; use math_compat.h a… Nov 22, 2016
json.h json_pointer: add first revision Nov 4, 2016
json_c_version.c Add a json_c_version.h header (included from json.h), and several mac… Dec 23, 2012
json_c_version.h Bump versions up to 0.12.99 since a 0.12 release was just created. Apr 11, 2014
json_config.h.in Include json_inttypes.h in json_object.h since we use types like int3… Feb 16, 2012
json_config.h.win32 Updated config for vs2010/winsdk71 as well as vs2013 Mar 4, 2015
json_inttypes.h Define macros from inttypes.h when not available Mar 4, 2015
json_object.c Restore sprintbuf(), add macro for string literals Feb 4, 2017
json_object.h string set and tests Oct 6, 2016
json_object_iterator.c Issue #236: Add -Wcast-qual and fix casts to retain constness. Jun 11, 2016
json_object_iterator.h Issue #76: use old style comment to allow json_object_iterator.h to b… Apr 30, 2013
json_object_private.h more efficient handling for smalls strings inside json_object Sep 23, 2015
json_pointer.c Add cast to int in calls to isdigit() since some platforms complain a… Feb 5, 2017
json_pointer.h json_pointer: add json_pointer_getf/setf() function variants Nov 22, 2016
json_tokener.c strdup_compat.h: re-spin this compat header ; use math_compat.h as te… Nov 22, 2016
json_tokener.h fix doc in tokener header file Feb 20, 2017
json_util.c Issue #189: Eliminate use of MC_ERROR from json_util.c, and add a jso… Jun 26, 2016
json_util.h Issue #189: Eliminate use of MC_ERROR from json_util.c, and add a jso… Jun 26, 2016
json_visit.c Add a json_c_visit() function to provide a way to iterate over a tree… Oct 29, 2016
json_visit.h Add a json_c_visit() function to provide a way to iterate over a tree… Oct 29, 2016
libjson.c Remove trailing whitespace Aug 26, 2014
linkhash.c Fix compilation without C-99 option Mar 2, 2017
linkhash.h Support for 64 bit pointers on Windows Sep 27, 2016
math_compat.h Define INFINITY and NAN when missing Mar 4, 2015
printbuf.c Restore sprintbuf(), add macro for string literals Feb 4, 2017
printbuf.h Restore sprintbuf(), add macro for string literals Feb 4, 2017
random_seed.c Add missing include file to random_seed Mar 4, 2015
random_seed.h Patch to address the following issues: Apr 9, 2014
strdup_compat.h strdup_compat.h: re-spin this compat header ; use math_compat.h as te… Nov 22, 2016
vasprintf_compat.h vasprintf_compat.h: spin-off this compat header ; use math_compat.h a… Nov 22, 2016

README.md

json-c {#mainpage}

JSON-C - A JSON implementation in C

JSON-C implements a reference counting object model that allows you to easily construct JSON objects in C, output them as JSON formatted strings and parse JSON formatted strings back into the C representation of JSON objects. It aims to conform to RFC 7159.

Building on Unix with git, gcc and autotools

Home page for json-c: https://github.com/json-c/json-c/wiki

Prerequisites:

  • gcc, clang, or another C compiler
  • libtool>=2.2.6b

If you're not using a release tarball, you'll also need:

  • autoconf>=2.64 (autoreconf)
  • automake>=1.10.3

Make sure you have a complete libtool install, including libtoolize.

json-c GitHub repo: https://github.com/json-c/json-c

$ git clone https://github.com/json-c/json-c.git
$ cd json-c
$ sh autogen.sh

followed by

$ ./configure
$ make
$ make install

To build and run the test programs:

$ make check

Linking to libjson-c

If your system has pkgconfig, then you can just add this to your makefile:

CFLAGS += $(shell pkg-config --cflags json-c)
LDFLAGS += $(shell pkg-config --libs json-c)

Without pkgconfig, you would do something like this:

JSON_C_DIR=/path/to/json_c/install
CFLAGS += -I$(JSON_C_DIR)/include/json-c
LDFLAGS+= -L$(JSON_C_DIR)/lib -ljson-c