JSON order mixed up

前端 未结 12 1320
感情败类
感情败类 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:21

    JavaScript objects, and JSON, have no way to set the order for the keys. You might get it right in Java (I don't know how Java objects work, really) but if it's going to a web client or another consumer of the JSON, there is no guarantee as to the order of keys.

提交回复
热议问题