kolypto / j2cli

Jinja2 Command-Line Tool, reworked
http://pypi.python.org/pypi/j2cli
BSD 2-Clause "Simplified" License
744 stars 82 forks source link

Arrays in json #59

Open nickstatka777 opened 4 years ago

nickstatka777 commented 4 years ago

Hello, I have a problem. When I try to pass an array from a template.json to the dest JSON file the result looks incorrect: example: template file: { "inpath": ["/2_dir","/3_dir"] }

in the destination file: { "paths": ['/2_dir', '/3_dir'] } I'm about single quote, however, it should be double quotes. So, what do I wrong?

robmoore commented 4 years ago

@nickstatka777 This can be accomplished using the tojson filter like so:

{{ my_array | tojson }}