You cannot and should not rely on the ordering of elements within a JSON object.
From the JSON specification at https://www.json.org/
An object is an unordered set ofname/value pairs
As a consequence,JSON libraries are free to rearrange the order of the elements as they see fit.This is not a bug.