📈 GH Trending Explorer 🎲 Surprise me

← all repos

DaveGamble / cJSON

git clone https://github.com/DaveGamble/cJSON.git v1.7.19 · 1y ago 🔥 on GitHub Trending today

Ultralightweight JSON parser and printer written in ANSI C, distributed as a single source file and header.

Why you might care

Useful when you need JSON handling in C without pulling in a heavy dependency. It ships as one .c and one .h file, so it is easy to vendor into an existing project. Licensed under MIT.

Categories

Alternatives

janssonjson-cRapidJSONsimdjsonnlohmann/json
+3
stars, 24h · #9,826
—
stars, 7 days
—
stars, 30 days
13k
★ total
3.5k
forks · 239 open issues

Star history starts 2026-10-23; the chart appears after the second daily snapshot.

LanguageC
LicenseMIT
Created2016-03-19 (10y ago)
Last push1mo ago
Watchers277
OwnerUser

Seen on GitHub Trending

  • 2026-10-23 — #9 daily in c · +3 ★

Links

README excerpt
# cJSON
Ultralightweight JSON parser in ANSI C.
## Table of contents
* License
* Usage
 * Welcome to cJSON
 * Building
 * Copying the source
 * CMake
 * Makefile
 * Meson
 * Vcpkg
 * Including cJSON
 * Data Structure
 * Working with the data structure
 * Basic types
 * Arrays
 * Objects
 * Parsing JSON
 * Printing JSON
 * Example
 * Printing
 * Parsing
 * Caveats
 * Zero Character
 * Character Encoding
 * C Standard
 * Floating Point Numbers
 * Deep Nesting Of Arrays And Objects
 * Thread Safety
 * Case Sensitivity
 * Duplicate Object Members
 * Enjoy cJSON!
## License
MIT License
> Copyright (c) 2009-2017 Dave Gamble and cJSON contributors
>
> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in
> all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> THE SOFTWARE.
## Usage
### Welcome to cJSON.
cJSON aims to be the dumbest possible parser that you can get your job done with.
It's a single file of C, and a single header file.
JSON is described best here: http://www.json.org/
It's like XML, but fat-free. You use it to move data around, store things, or just
generally represent your program's state.
As a library, cJSON exists to take away as much legwork as it can, but not get in your way.
As a point of pragmatism (i.e. ignoring the truth), I'm going to say that you can use it
in one of two modes: Auto and Manual. Let's have a quick run-through.
I lifted some JSON from this page: http://www.json.org/fatfree.html
That page inspired me to write cJSON, which is a parser that tries to share the same
philosophy as JSON itself. Simple, dumb, out of the way.
### Building
There are several ways to incorporate cJSON into your project.
#### copying the source
Because the entire library is only one C file and one header file, you can just copy `cJSON.h` and `cJSON.c` to your projects source and start using it.
cJSON is written in ANSI C (C89) in order to support as many platforms and compilers as possible.
#### CMake
With CMake, cJSON supports a full blown build system. This way you get the most features. CMake with an equal or higher version than

Blurb generated by claude-haiku-5-5 today. Star deltas marked ~ are extrapolated from partial history.