parcourir les donnée json
bonsoir j ai un petit probleme de parcours d un fichier json
je sais vraiment comment je vais acceder a mon tableau, je besoin d aide .
voici ce ke contient le fichier :
Code:
1 2
|
{"produit" : "nomproduit"} ["storeId":"10101","prodID":"10101","langId":"-2","categoryId":"10102"] |
voici comment j essai de le parcourir mais sans succes
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
ArrayList<Store> topCat = new ArrayList<Store>();
String str = stream2String(entity.getContent());
JSONObject ob= new JSONObject(str);
Store store= new Store();
store.storeId=ob.getInt("nomproduit");
JSONArray obj = new JSONArray(str);
for(int i=0;i<obj.length();i++)
{
JSONObject p= obj.getJSONObject(i);
store.prodId=p.getInt("prodId");
store.storeId=p.getInt("storeId");
store.langId = p.getInt("langId");
store.catalogId = p.getInt("catalogId");
topCat.add(store);
}
return topCat |
merci d avance
.