JSON order mixed up

前端 未结 12 1430
感情败类
感情败类 2020-11-22 02:01

I\'ve a problem trying to make my page printing out the JSONObject in the order i want. In my code, I entered this:



        
12条回答
  •  野的像风
    2020-11-22 02:25

    You cannot and should not rely on the ordering of elements within a JSON object.

    From the JSON specification at http://www.json.org/

    An object is an unordered set of name/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.

提交回复
热议问题