解析和反序列化的Android JSON对象 [英] Parse and deserialize JSON object in android
本文介绍了解析和反序列化的Android JSON对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我工作的一个Android应用程序。我在 JSON
以下数据,数据将在每次改变,所以我不知道什么是键值。我需要分析它和反序列化,以将其保存在 SQL精简版
。
I am working on an android application. I have the following data in JSON
and the data will be changed every time,so I don't know what are the key values. I need to parse it and deserialize in order to save it in SQL Lite
.
{
"genre":"2",
"imported_from":"1",
"release_year":"1999",
"import":"1",
"label":"1",
"artist":"Boards Of Canada ",
"album_title":"Music Has The Right To Children",
"formats":"1"
}
请指教。
推荐答案
试试这个:
String inputJSONString = ""; // Your string JSON here
JSONObject jObject = new JSONObject(inputJSONString);
Iterator<String> keys = jObject.keys();
while( keys.hasNext() ) {
String key = keys.next();
String value = jObject.getString(key);
}
这篇关于解析和反序列化的Android JSON对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文