将具有可能序列化JSON值的哈希图添加到JSON字符串作为节点

时间:2018-09-20 02:02:19

标签: java json hashmap

在JAVA中采用下面的jsonstringhashmap并产生result的最便宜方法是什么?

伪代码数据示例:

String jsonstring = {
  "people": {
    "name": "name1", 
  },
  "addresses": {
    "address1": {
      "number": "1234",
      "city": "europa"
    }
  }
}

HashMap hashmap = {
  ["string.a.1"] = "stringa1", 
  ["string.a.2"] = "stringa2", 
  ["object.a.1"] = "{/"item1/":/"value1/"}" // serialized JSON object
}

String result = {
  "people": {
    "name": "name1", 
  },
  "addresses": {
    "address1": {
      "number": "1234",
      "city": "europa"
    }
  },
  "buffer": {
    "string.a.1": "stringa1", 
    "string.a.2": "stringa2", 
    "object.a.1": {
      "item1": "value1"
    }
  }
}

在此先感谢您的帮助。

0 个答案:

没有答案