Home > Back-end >  Com. Alibaba. Fastjson. JSONObject by put add elements
Com. Alibaba. Fastjson. JSONObject by put add elements

Time:10-06

Through the com. Alibaba. Fastjson. The inside of the JSONObject put method adding elements, through debugging found when adding the third element, the key/value pair will be added to the second position, this is because what reason
 
JSONObject json=new JSONObject ();
Json. The put (" message ", "success");
Json. The put (" LoginId ", loginUser. GetId () + "");
Json. The put (" ipAdress idAddress);
Json. The put (" lastLoginTime ", lastLoginTime);

CodePudding user response:

Jsonobject is essentially a map of disorderly storage elements, if you want to order, add true parameter constructor

CodePudding user response:

. Com. Alibaba. Fastjson JSONObject storage and access is through the form of key-value pairs is disordered deposit,

CodePudding user response:

JsonObejct is unordered, equivalent to the map, if you want to use an orderly use linkedHashMap
  • Related