Strip leading and trailing brackets from prettified JSON
This commit is contained in:
parent
6a01aea5e1
commit
d8005fa15d
|
@ -6,4 +6,10 @@ register = template.Library()
|
|||
|
||||
@register.filter
|
||||
def pretty(data):
|
||||
return orjson.dumps(data, option=orjson.OPT_INDENT_2).decode("utf-8")
|
||||
prettified = orjson.dumps(data, option=orjson.OPT_INDENT_2).decode("utf-8")
|
||||
if prettified.startswith("{"):
|
||||
prettified = prettified[1:]
|
||||
if prettified.endswith("}"):
|
||||
prettified = prettified[:-1]
|
||||
|
||||
return prettified
|
||||
|
|
Loading…
Reference in New Issue