The order of sections in a JSON template can be determined simply by the order of properties in the `sections` attribute's value. So, I'm pretty confused about the purpose the `order` attribute.
Furthermore, when you reorder sections in a JSON template using the theme editor, the order of the entries in the `sections` attribute are changed to reflect the order of the sections in the theme editor. Hence, it seems like the `order` attribute is completely redundant, since the order of sections can simply be determined by looking at the order of sections in the `sections` attribute.
So I'm pretty confused about why JSON templates are designed this way. That is, why wasn't the `sections` attribute designed to be an array, instead of an object?
In other words, is there ever a useful case for when the order of sections that appear on the `order` attribute is different than the order of sections that appear on the `sections` attribute? Because it seems like this would be the only scenario where the current design makes sense. Am I missing something here?
You're correct in noting that when section arrangement changes are made in the theme editor that both the `sections` attribute and the `order` array is updated. Using the `order` array to arrange the default order can be helpful for theme developers selling themes on marketplaces, as they want to quickly and easily rearrange the order of sections for the default state, without needing to move the JSON objects around. Typically these templates are intended to be set up so that merchants and developers don't need to touch them, and changes can be made either via the theme editor or the respective Liquid section files.