Encodes value. Output is compact unless pretty (two-space indent). The result comes from
context.allocator.
- pretty: indents with two spaces and puts members on their own lines.
Point :: struct { x: int; y: int; }
text := to_json(Point.{ 1, 2 });
assert(text == "{\"x\":1,\"y\":2}");
free(text);to_json :: (value: $T, pretty := false) -> string
Encodes value. Output is compact unless pretty (two-space indent). The result comes from
context.allocator.
Parameters
- value: $T
- pretty := false
- indents with two spaces and puts members on their own lines.
Returns
- string
Point :: struct { x: int; y: int; }
text := to_json(Point.{ 1, 2 });
assert(text == "{\"x\":1,\"y\":2}");
free(text);