There's a real need for JSON templating languages not targeting developers. Tools like Zapier, Customer.io's webhooks, etc. allow integration with arbitrary APIs and have become a standard part of many marketing/sales stacks. These apps use things like Jinja, Mustache, or Liquid which are great for text but not JSON templates. Curly braces as primary delimiters, not allowing trailing commas on final elements, and oth…
What is it about "curly braces as primary delimiters" that you think is a hassle? What would you suggest instead?
{
"hello": {"{{place}}":{{{#items}}"{{thing}}":{{n}},{{/items}}}},
"urls": [{{#items}}"{{url}}",{{/items}}]
}
It's unambigious and can be reasoned through, but it's certainly hard to tell what structure the template is building at a glance. This is not a complex or contrived example.Syntax highlighting, linters, proper indentation, etc. all help...but when talking about non-programmers who aren't used to this it's an incredible hurdle. People are also lazy and error prone, so you can't rely on indentation to make things clear, especially since it's not always clear how you should indent nesting of the template vs nesting of the json datastructure you're trying to build.
Most modern templating languages have a config option for changing the delimeter. Setting it to something like (( or It's also worth pointing out that the above template generates subtly incorrect json with trailing commas. In pure mustache it's not possible to get rid of that trailing comma. You have to either change your data (add a "last":true key to the last element of any arrays), or have some kind of post-processing step.
All of the existing solutions are workable, they just aren't ideal.