Skip to content
Official code repository for json-c. See the wiki for release tarballs for download.
C M4 Shell Makefile HTML
Find file
Failed to load latest commit information.
autoconf-archive Use AX_APPEND_COMPILE_FLAGS() to check the various compile flags, suc… Oct 23, 2015
tests Add tests for the json_object_array_del_idx() function. Apr 30, 2016
.gitignore Add some basic tests for verifying json_object_equal behavior Jan 13, 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 Bump versions up to 0.12.99 since a 0.12 release was just created. Apr 10, 2014
Doxyfile Bump versions up to 0.12.99 since a 0.12 release was just created. Apr 11, 2014
Makefile.am Use AX_APPEND_COMPILE_FLAGS() to check the various compile flags, suc… Oct 23, 2015
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 Update README files with pointers to new github repo and googlegroups… Jun 14, 2011
README.md Fix minor typo in README file. Apr 19, 2014
RELEASE_CHECKLIST.txt Issue #137: remove config.h.in from change control. Dec 8, 2015
appveyor.yml Appveyor: Visual Studio v140 no longer fails Nov 5, 2015
arraylist.c Merge branch 'master' of https://github.com/Protovision/json-c into P… Apr 30, 2016
arraylist.h Added array_list_del_idx and json_object_array_del_idx Apr 2, 2015
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 Updated config for vs2010/winsdk71 as well as vs2013 Mar 4, 2015
configure.ac Merge pull request #216 from Jehan/master Apr 30, 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 11, 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 Merge branch 'master' of https://github.com/Protovision/json-c into P… Apr 30, 2016
json_object.h Merge branch 'master' of https://github.com/Protovision/json-c into P… Apr 30, 2016
json_object_iterator.c Since we already use a local json_bool type, replace any stdbool.h us… Apr 24, 2012
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 Introduce json_object_from_fd Jul 21, 2014
json_util.h Introduce json_object_from_fd Jul 21, 2014
libjson.c Remove trailing whitespace Aug 26, 2014
linkhash.c Merge commit '2be921d88376e78f84d79aafa6db2714da804e59' Dec 8, 2015
linkhash.h Merge commit '2be921d88376e78f84d79aafa6db2714da804e59' Dec 9, 2015
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

Building on Unix with git, gcc and autotools

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

Caution: do NOT use sources from svn.metaparadigm.com, they are old.

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.