djc / askama

Type-safe, compiled Jinja-like templates for Rust
Apache License 2.0
3.35k stars 215 forks source link

Allow output of not prettified JSON data #1019

Open FalkWoldmann opened 4 months ago

FalkWoldmann commented 4 months ago

Hi,

right know, |tojson will always prettify the output. This can lead to noisy output, e. g. when constructing a stringified object for a data- attribute. I think it would be a nice addition to toggle this functionality, perhaps with a new filter or with a parameter on the existing filter if that it possible?

This idea was already brought up in #192 and #1008.

What do you think?