#### Beyond Linux® From Scratch (systemd Edition) - Version r13.0-491

### Chapter 9. General Libraries

- Prev

  Jansson-2.15.0

- Next

  JSON-GLib-1.10.8

- Up
- Home

# JSON-C-0.18

## Introduction to JSON-C

The 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.

### Note

Development versions of BLFS may not build or run some packages properly if LFS or dependencies have been updated since the most recent stable versions of the books.

### Package Information

- Download (HTTP): https://s3.amazonaws.com/json-c_releases/releases/json-c-0.18.tar.gz

- Download MD5 sum: e6593766de7d8aa6e3a7e67ebf1e522f

- Download size: 396 KB

- Estimated disk space required: 7.9 MB

- Estimated build time: 0.2 SBU (with tests)

### JSON-C Dependencies

#### Required

CMake-4.3.2

#### Optional (for documentation)

Doxygen-1.17.0 and Graphviz-14.1.5 (for dot tool)

## Installation of JSON-C

First, fix building this package with CMake-4.0:

    sed -i 's/VERSION 2.8/VERSION 4.0/' apps/CMakeLists.txt  &&
    sed -i 's/VERSION 3.9/VERSION 4.0/' tests/CMakeLists.txt

Install JSON-C by running the following commands:

    mkdir build &&
    cd    build &&

    cmake -D CMAKE_INSTALL_PREFIX=/usr \
          -D CMAKE_BUILD_TYPE=Release  \
          -D BUILD_STATIC_LIBS=OFF     \
          .. &&
    make

If you have installed Doxygen-1.17.0 and Graphviz-14.1.5, you can build the documentation by running the following command:

    doxygen doc/Doxyfile

To test the results, issue: make test.

Now, as the `root` user:

    make install

If you built the documentation, install it by running the following commands as the `root` user:

    install -d -vm755 /usr/share/doc/json-c-0.18 &&
    install -v -m644 doc/html/* /usr/share/doc/json-c-0.18

## Command Explanations

`-D CMAKE_BUILD_TYPE=Release`: This switch is used to apply a higher level of compiler optimizations.

## Contents

Installed Programs: None
Installed Libraries: libjson-c.so
Installed Directories: /usr/include/json-c

### Short Descriptions

`libjson-c.so` | contains the JSON-C API functions

- Prev

  Jansson-2.15.0

- Next

  JSON-GLib-1.10.8

- Up
- Home