I don't understand. Sort method sorts only a same-level names of json-objects and it cannot to get into other same-level but of different parent. Sort method even can't access to values, just to names. Sort method does not rearrange parent names according to some child object.
If you look carefully, ShowJSONData calls itself giving a child node as a new AParent parameter.
The StringList is used to sort just one level, the siblings. That is how a tree must be sorted, otherwise the tree structure would change.
A tree data structure is inherently recursive, that is why a recursive function call is the most natural way to manipulate it.
In this case the data comes from a JSON file but it is not important. We could be now sorting any tree data.
See how the StringList is populated. There is Data and its sub-items Data.items. You have access to all data items and you can do whatever you want with them.
How to modify ShowJSONData? It's impossible, I think.
Everything is possible.
