Baike.dev
All toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
P

parson

> 编程语言
Open source

Lightweight JSON library written in C.

1.5K stars0 likes0 views
WebsiteGitHub

About

Lightweight JSON library written in C.

About

Parson is a lightweight json library written in C.

Features

  • Lightweight (only 2 files)
  • Simple API
  • Addressing json values with dot notation (similar to C structs or objects in most OO languages, e.g. "objectA.objectB.value")
  • C89 compatible
  • Test suites

Installation

Run:

git clone https://github.com/kgabis/parson.git

and copy parson.h and parson.c to you source code tree.

Run make test to compile and run tests.

Examples

Parsing JSON

Here is a function, which prints basic commit info (date, sha and author) from a github repository.

…

Calling print_commits_info("torvalds", "linux"); prints:

Date       SHA        Author
2012-10-15 dd8e8c4a2c David Rientjes
2012-10-15 3ce9e53e78 Michal Marek
2012-10-14 29bb4cc5e0 Randy Dunlap
2012-10-15 325adeb55e Ralf Baechle
2012-10-14 68687c842c Russell King
2012-10-14 ddffeb8c4d Linus Torvalds
...

Persistence

In this example I'm using parson to save user information to a file and then load it and validate later.

…

Serialization

Creating JSON values is very simple thanks to the dot notation. Object hierarchy is automatically created when addressing specific fields. In the following example I create a simple JSON value containing basic information about a person.

…

Output:

{
    "name": "John Smith",
    "age": 25,
    "address": {
        "city": "Cupertino"
    },
    "contact": {
        "emails": [
            "[email protected]",
            "[email protected]"
        ]
    }
}

Contributing

I will always merge working bug fixes. However, if you want to add something new to the API, please create an "issue" on github for this first so we can discuss if it should end up in the library before you start implementing it. Remember to follow parson's code style and write appropriate tests.

My other projects

  • ape - simple programming language implemented in C library
  • kgflags - easy to use command-line flag parsing library
  • agnes - header-only NES emulation library

License

The MIT License (MIT)

GitHub Issues· 30 open

View all on GitHub
  • #230

    [GLD Serializer Benchmark] C parson 1.5.3 — spec compliance misses

    Updated Sep 14, 2026
  • #225

    [benchmark] Request for call-path / fairness review (GLD.SerializerBenchmark)

    Updated Jul 17, 2026
  • #224

    Proposal: Continuous Coverage-Guided Fuzzing + Differential Parsing Validation

    Updated May 20, 2026
  • #220

    [PATCH]: new makefile argument for installing it as library.

    Updated May 4, 2025
  • #219

    Robustness for locales support

    Updated Feb 25, 2025
  • #213

    json_serialize_to_string_pretty received signal SIGABRT, Aborted.

    Updated Feb 28, 2024
  • #198

    Improve exception handling

    Updated Jan 8, 2023
  • #197

    Completion of error handling

    Updated Jan 8, 2023
  • #190

    scan-build bugs

    Updated Oct 25, 2022

Highlights

  • •Lightweight (only 2 files)
  • •Simple API
  • •Addressing json values with dot notation (similar to C structs or objects in most OO languages, e.g. "objectA.objectB.value")
  • •C89 compatible
  • •Test suites
  • •ape - simple programming language implemented in C library
  • •kgflags - easy to use command-line flag parsing library
  • •agnes - header-only NES emulation library

> Tags

Ccjsonjson-parserparser

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言