php - Getting JSON data and put them in 3 different arrays -
i'm working on android eclipse. i'm writing project app receives (also sends) info mysql database. wrote php file create project work. i'm using json communicate php file hosted in local server. don't have problems connection or similar problems receive type of json data:
{"field1":"a","field2":"abcbab","field3":5}, {"field1":"b","field2":"fakfef","field3":25}, {"field1":"a","field2":"faefe","field3":12}, {"field1":"c","field2":"aafefe","field3":30}, {"field1":"c","field2":"caere","field3":30},
etc..
now android app has target create 3 different arrays (one type of field1, 1 b , 1 c) subsequent processing json data. have 2 problems here.
i don't understand how select json value particular value of field. seek explain better, know these instructions:
jsonobject json_data = new jsonobject(result); json_data.getstring("field1");
but how say: "if field1 set value of field2 in arraya1 , field3 in arraya2", "if field1 b set value of field2 in arrayb1 , field3 in arrayb2", "if field1 c set value of field2 in arrayc1 , field3 in arrayc2". maybe i'm making harder looks don't know that. in way have 2 arrays each type of field1, there improve way want?. remember: can't alter code in php file output rows shown above.
php android mysql json
No comments:
Post a Comment