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 Other
Latest commit 9f9c332 Sep 13, 2016 @hawicz hawicz committed on GitHub Merge pull request #267 from sixlettervariables/patch-1
Removes me as Win32 maintainer, because I'm not.
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 Fix memory leak and inconsistent output (due to varying fd numbers) i… Aug 21, 2016
.editorconfig Adding a file for EditorConfig Aug 12, 2016
.gitignore Improving .gitignore Aug 8, 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 Add Cmakefile Aug 25, 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 Very minor changes not related to C source code Aug 8, 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 Improving README Aug 8, 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 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 5, 2014
config.h.win32 Issue #205: use _strdup instead of strdup on Windows. May 23, 2016
configure.ac Issue #246: Include xlocale.h too, to get locale_t defined, since not… Aug 3, 2016
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 Very minor changes not related to C source code Aug 8, 2016
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 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 Issue #260: add a check to prevent trivial loops in the object tree, … Aug 21, 2016
json_object.h Issue #263: add const so the prototype for json_object_object_add_ex(… Aug 25, 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 Revert bogus change to json_object_get() made in f40b08d that caused … Aug 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 initialize null terminator of new printbuf Jul 16, 2016
printbuf.h Remove the "#undef PRINTBUF_DEBUG" from printbuf.h so it can be more … Apr 5, 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