Skip to content
Official code repository for json-c. See the wiki for release tarballs for download.
C M4 Shell Makefile HTML
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 Fix absolute paths in test_util_file that vary depending on where it … Jun 27, 2016
.gitignore Issue #189: Eliminate use of MC_ERROR from json_util.c, and add a jso… Jun 26, 2016
.travis.yml Travis: add osx and clang builds Oct 9, 2015
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
COPYING Add my copyright. Jul 29, 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 Issue #113: Add more files to EXTRA_DIST and a dist-hook to get distc… Jun 27, 2016
NEWS Add a dummy "NEWS" file to automake doesn't complain. May 3, 2011
README Add an empty README file to placate autoconf. Apr 19, 2014
README-WIN32.html strndup is gone, remove it from the README file. Sep 8, 2013
README.html Mention that we're aiming to follow RFC 7159 now. Jun 8, 2016
README.md Mention that we're aiming to follow RFC 7159 now. Jun 8, 2016
RELEASE_CHECKLIST.txt Issue #113: add "new" files to appropriate variables in Makefile, and… Jun 27, 2016
appveyor.yml Appveyor: Visual Studio v140 no longer fails Nov 5, 2015
arraylist.c Fix a few places that needed adjustment for the size_t changes, inclu… May 23, 2016
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 4, 2014
config.h.win32 Issue #205: use _strdup instead of strdup on Windows. May 23, 2016
configure.ac Issue #236: Add -Wcast-qual and fix casts to retain constness. Jun 11, 2016
debug.c Remove trailing whitespace Aug 26, 2014
debug.h Eliminate the deprecated mc_abort() function and MC_ABORT macro. Mar 22, 2014
json-c-uninstalled.pc.in Re-add the "json" pkg-config file as a compatibility shim. Jul 29, 2012
json-c.pc.in Link against libm when needed May 1, 2015
json-c.vcproj Adds json_config.h.win32 to project. Adds VS2k13 project. Dec 5, 2014
json-c.vcxproj Build random_seed.c as well Mar 4, 2015
json-c.vcxproj.filters Build random_seed.c as well Mar 4, 2015
json.h Move the json_min() and json_max() macros to json_util.h and mark eve… May 5, 2014
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 10, 2014
json_config.h.in Include json_inttypes.h in json_object.h since we use types like int3… Feb 15, 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 Issue #236: Add -Wcast-qual and fix casts to retain constness. Jun 11, 2016
json_object.h Issue #236: Add -Wcast-qual and fix casts to retain constness. Jun 11, 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_tokener.c Fix various potential null ptr deref and int32 overflows Jan 11, 2016
json_tokener.h Remove trailing whitespace Aug 26, 2014
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
libjson.c Remove trailing whitespace Aug 26, 2014
linkhash.c linkhash.c: optimised the table_free path Jun 25, 2016
linkhash.h linkhash.h: removed redundant params from comments Jun 25, 2016
math_compat.h Define INFINITY and NAN when missing Mar 4, 2015
printbuf.c Move the json_min() and json_max() macros to json_util.h and mark eve… May 5, 2014
printbuf.h Remove the "#undef PRINTBUF_DEBUG" from printbuf.h so it can be more … Apr 4, 2012
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

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

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

  • autoconf (autoreconf)
  • automake

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
Something went wrong with that request. Please try again.