/* * jsonb_pretty: * Pretty-printed text for the jsonb */ Datum jsonb_pretty(PG_FUNCTION_ARGS) { Jsonb *jb = PG_GETARG_JSONB(0); StringInfo str = makeStringInfo(); JsonbToCStringWorker(str, &jb->root, VARSIZE(jb), true); PG_RETURN_TEXT_P(cstring_to_text_with_len(str->data, str->len)); }
/* * same thing but with indentation turned on */ char * JsonbToCStringIndent(StringInfo out, JsonbContainer *in, int estimated_len) { return JsonbToCStringWorker(out, in, estimated_len, true); }