JSON order mixed up

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

    Underscore-java uses linkedhashmap to store key/value for json. I am the maintainer of the project.

    Map myObject = new LinkedHashMap<>();
    myObject.put("userid", "User 1");
    myObject.put("amount", "24.23");
    myObject.put("success", "NO");
    
    System.out.println(U.toJson(myObject));
    

提交回复
热议问题