fengchao000 2019-12-28
1 json string 转 JSONObject
try { JSONObject jsonObject = new JSONObject("{\"phonetype\":\"N95\",\"cat\":\"WP\"}"); }catch (JSONException err){ Log.d("Error", err.toString()); }
2 json string 转 JsonNode
ObjectMapper mapper = new ObjectMapper(); JsonNode node = mapper.readTree(jsonString);
3 json string 装map
Map<String, String> map = mapper.readValue(jsonstring, Map.class);