On 2016-06-16 15:29, Mattias Gaertner wrote:
> Have you seen this page:

Yes, that's what I looked at to see how to use for..in but nowhere does
it mention or give a JSON example. Granted, I haven't read every single
word on that page, but a lot seem to cover how to implement an iterator
for your own containers so for..in loops can work with it. This was not
what I was looking for.

The fpjson unit already supports the for..in loop, I just didn't know
[immediately obvious] what data type the loop variable must be - hence
my question.

So it seems the only way to use for..in on moderate to complex objects
[that you haven't looped before], is to delve into the source code and
see how the enumerator class was implemented, and there you will find
the loop variable type to use.

Regards,
  Graeme

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to