sempare / sempare-delphi-template-engine

Sempare Template (scripting) Engine for Delphi allows for flexible dynamic text generation. It can be used for generating email, html, reports, source code, xml, configuration, etc.
Apache License 2.0
144 stars 18 forks source link

JSON for in/of must be reviewed #212

Open darnocian opened 1 month ago

darnocian commented 1 month ago

when doing a for loop over TJSONObject, the for in/of is not consistent with normal arrays and dictionaries.

normally, 'for in', will loop over the indices, where 'for of' will loop over the values.

Havn't tested exhaustively, but noticed that with the TJSONValue:

{
 "globals": [ 5,4,3]
}

and

<% for x in globals ; x ; betweenitems %>, <% end %>

should give

 0, 1, 2

but it gives:

 5, 4, 3

This is the behaviour of

<% for x of globals ; x ; betweenitems %>, <% end %>