convert json string to json object java code example
Example 1: convert json string to json object in java
try {
JSONObject jsonObject = new JSONObject("{\"phonetype\":\"N95\",\"cat\":\"WP\"}");
}catch (JSONException err){
Log.d("Error", err.toString());
}
Example 2: convert java object to json
Jackson Data-bind depdendency that take care of
Converting between
JSON to Java Object
and
Java Object to JSON
com.fasterxml.jackson.core
jackson-databind
2.12.0