Does the order in the Raw Output match the order defined in the code?

A user asked us over email:

I’ve created a simulation and defined a set of properties on an agent in a particular order that I’d like preserved when executed. However, when I look at the raw output, the properties are in a different order. How can I ensure that the order of properties matches the code definition?


  1. At the moment, we use JSON as an interchange format for simulation state, which does not guarantee any particular key order, or remember the order of key insertion.

  2. For our hCloud computation (if you run an experiment with ‘Cloud Active’), we use a datastore that has an order of fields for simulation that cannot be guaranteed to be the order in which fields were inserted for any one agent.

So if you require a deterministic order for reading key-value data from agent state, sort the data (or a copy of it) before working with it.