8000 GitHub - Friedchicken-42/con: C Object Notation
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Friedchicken-42/con

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CON

C Object Notation. C support for JSON

Run Locally

  git clone https://github.com/Friedchicken-42/con con-main
  cd con-main
  make

Usage/Example

Read/Write JSON file

on *o = NULL;
json_err* err = json_load("file.json", &o);
json_dump(obj, "file.json");

Create object from scratch

int x = 42;

on *obj = on_create_object();
on_add(obj, "question", "What is the answer to the utlimate question?", ON_STRING);
on_add(obj, "answer", &x, ON_INTEGER);

Create array from scratch

on* arr = on_create_array();
on_add(arr, NULL, "test1", ON_STRING);
on_add(arr, NULL, "test2", ON_STRING);
on_add(arr, NULL, "test3", ON_STRING);

Get value from a specific key

char *question = on_get(obj, "question");
printf("question: %s\n", question);

Free Object

on_free(obj);

TODO:

  • add load/dump for other format
    • toml
    • xml
    • yarn
    • ini

About

C Object Notation

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0