You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 1.5 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. `json-c` {#mainpage}
  2. ========
  3. JSON-C - A JSON implementation in C
  4. -----------------------------------
  5. JSON-C implements a reference counting object model that allows you to easily
  6. construct JSON objects in C, output them as JSON formatted strings and parse
  7. JSON formatted strings back into the C representation of JSON objects.
  8. It aims to conform to [RFC 7159](https://tools.ietf.org/html/rfc7159).
  9. Building on Unix with `git`, `gcc` and `autotools`
  10. --------------------------------------------------
  11. Home page for json-c: https://github.com/json-c/json-c/wiki
  12. Prerequisites:
  13. - `gcc`, `clang`, or another C compiler
  14. - `libtool`
  15. If you're not using a release tarball, you'll also need:
  16. - `autoconf` (`autoreconf`)
  17. - `automake`
  18. Make sure you have a complete `libtool` install, including `libtoolize`.
  19. `json-c` GitHub repo: https://github.com/json-c/json-c
  20. ```sh
  21. $ git clone https://github.com/json-c/json-c.git
  22. $ cd json-c
  23. $ sh autogen.sh
  24. ```
  25. followed by
  26. ```sh
  27. $ ./configure
  28. $ make
  29. $ make install
  30. ```
  31. To build and run the test programs:
  32. ```sh
  33. $ make check
  34. ```
  35. Linking to `libjson-c`
  36. ----------------------
  37. If your system has `pkgconfig`,
  38. then you can just add this to your `makefile`:
  39. ```make
  40. CFLAGS += $(shell pkg-config --cflags json-c)
  41. LDFLAGS += $(shell pkg-config --libs json-c)
  42. ```
  43. Without `pkgconfig`, you would do something like this:
  44. ```make
  45. JSON_C_DIR=/path/to/json_c/install
  46. CFLAGS += -I$(JSON_C_DIR)/include/json-c
  47. LDFLAGS+= -L$(JSON_C_DIR)/lib -ljson-c
  48. ```