From 83aa7863c1d9da390ff64fa0debf9040c37e67a0 Mon Sep 17 00:00:00 2001 From: Julian Bez Date: Wed, 21 Feb 2024 13:23:08 +0100 Subject: [PATCH] Restore browsable API JSON indentation --- posthog/renderers.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/posthog/renderers.py b/posthog/renderers.py index a733c4f17b5aa..fa2d532fdce70 100644 --- a/posthog/renderers.py +++ b/posthog/renderers.py @@ -12,4 +12,9 @@ def render(self, data, accepted_media_type=None, renderer_context=None) -> bytes if data is None: return b"" - return orjson.dumps(data, default=JSONEncoder().default, option=orjson.OPT_UTC_Z) + option = orjson.OPT_UTC_Z + + if renderer_context and renderer_context.get("indent"): + option |= orjson.OPT_INDENT_2 + + return orjson.dumps(data, default=JSONEncoder().default, option=option)