noahmorrison/chevron

Booleans (true|false) are rendered as Python booleans (True|False)

ricanontherun opened this issue · 3 comments

Given the follow template and data file:

template.mustache

true={{true-value}}
false={{false-value}}

data.json

{
  "true-value": true,
  "false-value": false
}

I receive the following output:

$ chevron -d data.json template.mustache
true=True
false=False

In my opinion, this should not work this way, booleans should be rendered in supported JSON format (true|false)

Interesting. The chevron tool understands JSON as a data input format, but I don't believe there's any JSON support for output. I think it's all just text really other than the HTML escaping functionality.

The way I see it, input (true|false booleans) should not be transformed into something else (True|False booleans) on output. If you agree, and are looking for some help ... I'd be willing contribute a patch for this. Let me know!

I think the only way to do that reliably in something like Mustache is to do those imports as strings instead of booleans.