https://github.com/meithal/ccson
Single header CSON parser in C
https://github.com/meithal/ccson
coffeescript cson json parser
Last synced: 2 months ago
JSON representation
Single header CSON parser in C
- Host: GitHub
- URL: https://github.com/meithal/ccson
- Owner: Meithal
- License: mit
- Created: 2021-06-29T01:47:35.000Z (almost 4 years ago)
- Default Branch: cson
- Last Pushed: 2021-06-29T11:36:20.000Z (almost 4 years ago)
- Last Synced: 2025-02-01T23:14:30.653Z (4 months ago)
- Topics: coffeescript, cson, json, parser
- Language: C
- Homepage:
- Size: 170 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
CCSON is a [CSON](http://noe.mearie.org/cson/) library in C.
It comes as a single file and has one function that converts
CSON text to JSON text.## Requirements
* C11 compiler.
* ``.
Tested with MSVC and GCC.## Example
```c
#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.