How to define and iterate a list of associative arrays (or json) in templates?

I need to generate html from a static set of data within templates. I tried to set an array like this but it says " = expected a value that can be negated"
{% set data = [{"name": "Alice"}, {"name": "Bob"}] %}

What is the correct way to handle this?

I don’t know if this is supported. See this similar question Allow `load_data` to take a literal?

@skygate2012 support for this feature has been merged into the next branch for Zola: Allow `load_data` to take a literal by asimpletune · Pull Request #1794 · getzola/zola · GitHub

In the meanwhile, one workaround that you can use is to create an “echo” server, I.e. a server that responds back with whatever you send to it, to load json literals. It’s not ideal but I can verify that this works.

Thanks!

Map literals should be doable in the next version of Tera, but not timeline whatsoever for that and it’s not implemented yet.