我有名为jsonString
的String变量:
{"phonetype":"N95","cat":"WP"}
现在我想将其转换为JSON对象.我在Google上搜索了更多,但没有得到任何预期的答案...
我有名为jsonString
的String变量:
{"phonetype":"N95","cat":"WP"}
现在我想将其转换为JSON对象.我在Google上搜索了更多,但没有得到任何预期的答案...
使用 org.json 库:
try {
JSONObject jsonObject = new JSONObject("{\"phonetype\":\"N95\",\"cat\":\"WP\"}");
}catch (JSONException err){
Log.d("Error", err.toString());
}