(In reply to NicoV from comment #5)
> This solution would be awkward when several parameters are related one to
> each other. For example, on the cite templates, you usually have several
> fields for each author (first name, last name, page link, ...) and they are
> easier to manage for a user if they are grouped.
> With lists, users would have to be careful and to be sure that several lists
> are coherent between each other.

One way to deal with this could be to pass JSON blobs into template parameters. So you could have:

{{cite web
| authors = { "last": "Smith", "first": "John" }, { "last": "Doe", "first": "Jane" }
}}

This is nice from a Lua perspective, but it would be confusing for users. Mixing template syntax with JSON syntax seems ugly, and probably only a select few editors will be capable of entering syntactically correct JSON into template parameters.

The established way of doing something like this is to use a sub-template. So we would have something like:

{{cite web
| authors = {{author|last=Smith|first=John}}, {{author|last=Doe|first=Jane}}
}}

One problem with this is that the {{author}} templates are expanded before they are passed to Lua, so we lose data granularity. To solve this, we can use Lua to make the {{author}} templates output JSON and then read that JSON from the Lua module implementing {{cite web}}. But then to guarantee that we get clean JSON code we would need to make a template structure like this:

{{cite web
| authors = {{author list | {{author|last=Smith|first=John}} | {{author|last=Doe|first=Jane}} }}
}}

With this we have data grouping that can be reliably processed by Lua and that editors used to using wikitext will find intuitive. However, this would be hard for VisualEditor etc. to process and display to users in a meaningful way, as there is no guarantee how the {{author list}} and {{author}} templates will be implemented on any given wiki. So, instead of using Lua to create the JSON, we could do it in PHP using a new parser function. (I suggest "#data".) That would give us the following: 

{{cite web
| authors = {{#data: {{#data:last=Smith|first=John}} | {{#data:last=Doe|first=Jane}} }}
}}

This would give us a data structure that could be reliably parsed from VisualEditor, as well as the other benefits mentioned above. Perhaps it could displayed as a dynamically generated data tree (I'm thinking about something like json2html, but editable).

http://visualizer.json2html.com/

We would need to be careful about bad input:

{{cite web
| authors = foo {{#data: bar {{#data:last=Smith|first=John}} | {{#data:last=Doe|first=Jane}} baz }}
}}

To sanitise this, we could make the #data implementation throw an error (perhaps like a cite.php error) for "bar" and "baz" in this example. For "foo", we could leave it to the Lua module to properly validate the input.

We would also have to think carefully about what to do with templates etc. inside #data parser functions. If template expansion inside #data parser functions worked the same way that it did in normal wikitext, it would be difficult to make #data work well in VisualEditor. But perhaps it can be made to work in the same way that VE handles other instances of templates in template parameters.