Flesh out the repository with example and tests

This commit is contained in:
ktkk 2025-10-09 15:07:32 +00:00
parent 546eaa5d4d
commit 05c45bbc81
8 changed files with 165 additions and 57 deletions

26
example/main.c Normal file
View file

@ -0,0 +1,26 @@
#include <stdio.h>
#include <json.h>
int main()
{
auto json = json_init(stdout, INDENT_2);
json_begin_object(&json);
{
json_add_object_field(&json, "array");
json_begin_array(&json);
{
json_add_string(&json, "element");
json_add_long(&json, 5l);
json_add_double(&json, 3.14);
json_add_bool(&json, true);
json_add_null(&json);
}
json_end_array(&json);
}
json_end_object(&json);
json_free(&json);
}