cjson · Section 3
cjson_serialize_pretty
NAME
cjson_serialize_pretty - serialize a DOM tree to an indented JSON string
LIBRARY
C Collections (libccollections, -lccollections)
SYNOPSIS
#include <ccollections/cjson.h> char *cjson_serialize_pretty(cjson node, unsigned int indent);
DESCRIPTION
Works like cjson_serialize(), but writes newlines and indents each nesting level with spaces. An indent of 0 selects the default of 4 spaces, so for compact output with no indent you use cjson_serialize() instead. Object members come out in the same insertion order as with cjson_serialize(3).
RETURN VALUE
A null-terminated string on the heap, from the root node's allocator. Free it the same way as the result of cjson_serialize(3): With cjson_serialize_free() when the tree uses the default allocator, and with cjson_serialize_free_mp() when it uses a custom one.