如何在java中保留Simple JSONObject中的插入顺序

时间:2017-11-14 13:46:12

标签: java json simplejson

我有一个包含多个子对象的json字符串,在使用

转换此字符串时
JSONObject jsonObject=(JSONObject) JSONValue.parse(jsonString);

在jsonObject中错过了插入顺序,特别是 dataCollection 对象。 在转换过程中是否有方法或任何库来保留元素顺序?

示例Json:

{
  "Id": "f4a305705b064074a0ed15531031f3d0",
  "FirstName": "Name",
  "description": "Description",
  "data": {
    "dataCollection": {
      "Location": 883000,
      "Type": "Vehicle",
      "isRegistered": true,
      "wheels": 4,
      "isPowerSteered": "yes"
    },
    "Region": "India"
  }
}

0 个答案:

没有答案
相关问题