The order of properties as presented in the web interface is specified in https://www.wikidata.org/wiki/MediaWiki:Wikibase-SortedProperties . You can use the same list to order the data you get from any API response accordingly.

Note that, technically, the order of elements in a JSON object (curly brackets) is unspecified. This is what the JSON specification dictates. This becomes relevant when, for example, you are using a Java Set. You can iterate a Set, but the order will be pretty much randomized.

The order you can see in the wikidata.org API responses is basically the order in which the statements are stored in the database. This order mostly reflects the order in which the statements have been created. But this is not guaranteed and can change any time.

Best
Thiemo