Reputation: 1422
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"
}
Please advise.
Upvotes: 0
Views: 2476
Reputation: 1090
Try this:
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);
}
Upvotes: 3