JSON order mixed up

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

    u can retain the order, if u use JsonObject that belongs to com.google.gson :D

    JsonObject responseObj = new JsonObject();
    responseObj.addProperty("userid", "User 1");
    responseObj.addProperty("amount", "24.23");
    responseObj.addProperty("success", "NO");
    

    Usage of this JsonObject doesn't even bother using Map<>

    CHEERS!!!

提交回复
热议问题