because I bring the data into a dynamic table by looping through everything in a loop. The table has about 100 fields.
To do this manually is not realistic.
The proper way is to have some extra data point that describes the order of fields, eg a list of strings. Iterate over that list and use it to access the fields in the map/object.
Try storing the data you retrieve as “local” variables in YottaDB. The data is always sorted. See https://docs.yottadb.com/MultiLangProgGuide/goprogram.html for more information. For what it’s worth, YottaDB also has a hierarchical key-value database / persistence engine (called “global” variables), but if you already have a database, you can just store the retrieved data in YottaDB without using the persistence engine.