One JSON value. Only the fields of its kind are used: BOOL boolean NUMBER text, the number as written (exact for integers of any size; see json_as_s64) STRING text, the contents with escapes resolved ARRAY items OBJECT members, in document order (duplicate keys are kept; json_get finds the last) Everything a Json_Value owns comes from context.allocator; free_json releases it.
doc := json_object();
json_set(*doc, "name", json_string("Ada"));
tags := json_array();
json_push(*tags, json_int(1));
json_set(*doc, "tags", tags);
text := to_json(doc);
assert(text == "{\"name\":\"Ada\",\"tags\":[1]}");
free(text);
free_json(*doc);Fields
- kind: Json_Kind
- boolean: bool
- text: string
- items: [..] Json_Value
- members: [..] Json_Member