Hi Vadim,
In Mendix, a list is always considered to be of the same type. That doens't mean that all attributes/associations of each object must be filled. I can create a list like above by creating two entities, having 3 associations in between: id, name and surname. The first entity without any other attributes and the second entity having 1 and 2 as attribute names.
In the first set of objects I create, I only set the id association, the second only the name association and the third only the surname association.
So, if the set of options is not too big, you could model this completely in Mendix. But to have the “surname” a variable name in your JSON, that is not possible using the Mendix native export to JSON functionality. In that case, you should consider custom Java actions.
Hopefully this helps!
Kind regards,
Johan