【问题标题】:Convert com.google.gson.JsonObject to org.json.simple.JSONObject将 com.google.gson.JsonObject 转换为 org.json.simple.JSONObject
【发布时间】:2017-06-06 15:10:29
【问题描述】:

简单但棘手,如何在不知道内部属性或手动解析的情况下将com.google.gson.JsonObject 转换为org.json.simple.JSONObject

【问题讨论】:

    标签: java json parsing gson


    【解决方案1】:

    到目前为止,我的解决方案是使用org.json.simple.parser.JSONParser 来做到这一点:

    (JSONObject) new JSONParser().parse("{...}"); // JSON string generated via `com.google.gson.Gson`
    

    享受吧!

    【讨论】:

      猜你喜欢
      • 2020-12-13
      • 2017-09-24
      • 2022-01-21
      • 1970-01-01
      • 1970-01-01
      • 2023-04-05
      • 2020-10-22
      相关资源
      最近更新 更多