Add means to specify output type for JSON
Opened this issue · 0 comments
RhetTbull commented
Currently, all JSON fields are converted to strings because the output of the template system is strings. It would be helpful for JSON output to be able to specify the output type.
This could be done outside the template system with something like this:
"{field}|int"
The |int
filter would have to be the last thing on the line. Other types could be float
, bool
, and null
. null could be chained and would pass the original value or null if the original value was empty string.
This could also be done inside the template system to have a special template field that would cast a type and not convert to string but this is probably more difficult to implement and likely less readable. Eg. "{int,{field}}"