ObjectMapper objectMapper = new ObjectMapper(); MyObject myObject = objectMapper.readValue(jsonString, MyObject.class); Gson gson = new Gson(); MyObject myObject = gson.fromJson(jsonString, MyObject.class); ObjectMapper objectMapper = new ObjectMapper(); String jsonString = objectMapper.writeValueAsString(myObject); JSONObject jsonObject = new JSONObject(); jsonObject.put("key1", value1); jsonObject.put("key2", value2); String jsonString = jsonObject.toJSONString();


上一篇:
下一篇:
切换中文