rinja-rs / rinja

A template rendering engine based on Jinja, generating type-safe Rust code at compile time.
https://rinja.readthedocs.io
Apache License 2.0
116 stars 10 forks source link

Make JSON prettifying optional #32

Closed Kijewski closed 3 months ago

Kijewski commented 3 months ago

This PR adds an optional argument to the |tojson filter, which controls if the serialized JSON data gets prettified or not. The arguments works the same as flask's |tojson filter, which passes the argument to python's json.dumps():

This is a breaking change, because it changes the default behavior to not prettify the data. This is done intentionally, because this is how it works in flask.

GuillaumeGomez commented 3 months ago

Looks much simpler now, thanks! Please feel free to merge once CI pass.