Reading help file: https://github.com/hgourvest/superobject/blob/master/README.md
And then reading sources for TSuperArray ('Use the source, Luke')
Results in the following snippet:
var
obj: ISuperObject;
a: TSuperArray; // shortcut
begin
obj := TSuperObject.Create(stArray);
// or obj := SA([]);
a := obj.AsArray;
a.s[0] := 'aaaa';
a.s[1] := 'bbbb';
a.s[3] := 'cccc';
...
obj.SaveTo('File.txt');
a := nil; obj := nil;
...
end;
There is also the quote from help file: obj['foo[]'] := value; // add an item array
This suggests another way to populate an array (if the root object itself is not an array). Quoting http://code.google.com/p/superobject/source/browse/tests/test_usage.dpr
my_array := TSuperObject.Create(stArray);
my_array.I[''] := 1; // append
my_array.I[''] := 2; // append
my_array.I[''] := 3; // append
my_array.I['4'] := 5;
And later this object-array is inserted as property into yet another object
my_object := TSuperObject.Create(stObject);
my_object.I['abc'] := 12;
// my_object.S['path.to.foo[5]'] := 'bar';
my_object.B['bool0'] := false;
my_object.B['bool1'] := true;
my_object.S['baz'] := 'bang';
my_object.S['baz'] := 'fark';
my_object.AsObject.Delete('baz');
my_object['arr'] := my_array;
array of variant
and then use SA helper to create array – Hypochromiaobj := ctx.AsJson<TData>(data);
- look into sources (or into debugger) how this is actually implemented. – Hypochromia