I have my json file in my raw folder. I have parsed 5 json files. this last one is unable to parse
{
names :
{
"appliances" :
[
"fan",
"light"
],
"furniture" :
[
"chair",
"table"
]
.
.
.
.
}
}
here i want to use hash map to link it to next table where..
appliances, furnitures are all a seperate json file key and chair, table or all seperate json file key, Here i use Hash Map and vector to map all the keys and values of the three files. Now i just need the Way to use the JSONObject and JSONArray effeciently for this file alone.
For example
appliances_groups=parseFile(R.raw.appliances);//function parse file to read json file and store in a string
JSONArray JSONArray_groups= new JSONArray(appliances_groups);
String y ="";
int i;
for (i = 0; i < JSONArray_groups.length(); i++) {
JSONObject JSONObject_groups = JSONArray_groups.getJSONObject(i);
HashMap group_elements = new HashMap();
then i couldnt proceed
.. here how to effectively use JSONObject ands JSONArray? Please help!
You should try to use a JSON parsing lib, it’s much easier.
Jackson is a really good JSON lib, take a look: jackson.codehaus.org
First steps: JacksonInFiveMinutes