Meithal / ccson

Single header CSON parser in C

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CCSON is a CSON library in C. It comes as a single file and has one function that converts CSON text to JSON text.

Requirements

  • C11 compiler.
  • <uchar.h>.

Tested with MSVC and GCC.

Example

#define CSON_IMPLEMENTATION
#include "cson.h"

int main(void) {
    unsigned char sink[1000] = { 0 };
    puts(cson_to_json("pi: 3.141592, e = 2.718281828, 'foo': 'bar'", sink, 1000));
    /* 
     * {
          "pi": 3.141592,
          "e": 2.718281828,
          "foo": "bar"
        } 
    */
}

Many more examples and use cases are in the tests file.

About

Single header CSON parser in C

License:MIT License


Languages

Language:C 97.2%Language:CMake 2.8%