value - update nested json object java




Convert a gson.JsonObject to JSONObject (2)

get JSON string again from JsonObject and parse it in JSONObject

JsonObject gson = new JsonParser().parse("{\"id\":\"value\"}").getAsJsonObject();

JSONObject jo2 = new JSONObject(gson.toString());

I have a gson.JsonObject object. What is the easiest way to create a org.json.JSONObject object from it?


new org.json.JSONObject(gson.toJson(gson.JsonObject));




gson