var
  jo: ISuperObject;
  e: TSuperEnumerator;
begin 
  jo: = SO ('{A: 1, B: 2, C: 3, D: [4, 5, {X: 6}, {Y: [7,8, {m: 9}]}]}');
  e: = jo.GetEnumerator;
  while e.MoveNextdo
  begin
    ShowMessage (e.Current.AsString);
  end ;
  e.Free;
end ;

// The above program has no practical value, because the following sentence can replace the above:
var
  jo, i: ISuperObject;
begin 
  jo: = SO ('{A: 1, B: 2, C: 3, D: [4, 5, {X: 6}, {Y: [7,8, {m: 9}]}]}');
  for iin jodo ShowMessage (i.AsString);
end ;


The only values ​​enumerated by TSuperEnumerator are Name: Value; the

enumeration by TSuperAvlIterator is the TSuperAvlEntry object (which contains Name and Value); the

method for obtaining TSuperAvlIterator:
TSuperTableString.GetEnumerator or ISuperObject.AsObject.GetEnumerator.

var
  jo: ISuperObject;
  ite: TSuperAvlIterator;
begin 
  jo: = SO ('{A: 1, B: 2, C: 3, D: [4, 5, {X: 6}, {Y: 7}]}');

  ite: = jo.AsObject.GetEnumerator;

  ite.First;
  ShowMessageFmt ('% s:% s', [ite.Current.Name, ite.Current.Value.AsString]);

  ite.Next;
  ShowMessageFmt ('% s:% s', [ite.Current.Name, ite.Current.Value.AsString]);

  ite.Last;
  ShowMessageFmt ('% s:% s', [ite.Current.Name, ite.Current.Value.AsString]);

  ite.Prior;
  ShowMessageFmt ('% s:% s', [ite.Current.Name, ite.Current.Value.AsString]);

  ite.Free;
end ;


ObjectFindFirst, ObjectFindNext, ObjectFindClose are another way to enumerate elements.

It uses a structure:

TSuperObjectIter = record
  key: SOString;
  val: ISuperObject;
  Ite: TSuperAvlIterator;
end ;

//Application examples:
var
  jo: ISuperObject;
  iter: TSuperObjectIter;
begin 
  jo: = SO ('{A: 1, B: 2, C: 3, D: [4, 5, {X: 6}, {Y: 7}]}');

  if ObjectFindFirst (jo, iter)then
  begin
    repeat 
      ShowMessageFmt ('% s-% s', [iter.key, iter.val.AsString]);
    until not ObjectFindNext (iter);
  end ;
  ObjectFindClose (iter);
end ;

//or:
var
  jo: ISuperObject;
  iter: TSuperObjectIter;
begin 
  jo: = SO ('{A: 1, B: 2, C: 3, D: [4, 5, {X: 6}, {Y: 7}]}');

  if ObjectFindFirst (jo, iter)then
  begin
    repeat 
      ShowMessageFmt ('% s-% s', [iter.Ite.Current.Name, iter.Ite.Current.Value.AsString]);
    until not ObjectFindNext (iter);
  end ;
  ObjectFindClose (iter);
end ;