android - JSONObject or JSONArray -
i have data on string, i'm having trouble access individual data. code:
log.d("detail outputss", "" + response.tostring());
and string output:
{"futsal_id":"45","info":[{"futsal_id":"45","futsal_name":"kathmandu futsal","city":"kathmandu","address":"kathmandu","owner_name":"hari prasad","owner_address":"kathmandu","email":"kathmandufutsal@gmail.com","password":"kathmandu","phone_no":"1111111","mobile_no":"9841112233","status":"1"}],"description":[{"futsal_id":"45","futsal_desc":"futsal fever never ends.\r\nkathmandu futsal - platform, medium of communication our fraternity. not somewhere host challenges or seek venues, place can share , spread luv! here, can find anything, anything, , see anything. unbelievable? believe it."}],"features":[{"futsal_id":"45","futsal_feat":"free wifi"},{"futsal_id":"45","futsal_feat":"high quality grass"},{"futsal_id":"45","futsal_feat":"canteen facility"},{"futsal_id":"45","futsal_feat":"friendly environment"}],"dimension":[{"futsal_id":"45","dimension":"40m x 20m"}],"no_of_futsal":[{"futsal_id":"45","number":"1"}],"opening_hrs":[{"futsal_id":"45","open_time_id":"1","open_time":"6am","close_time_id":"15","close_time":"9pm"}],"price_weekdays_price1":[{"futsal_id":"45","price_id":"1","start_time":"6am","end_time":"12pm","price":"1200"}],"price_weekdays_price2":[{"futsal_id":"45","price_id":"2","start_time":"12pm","end_time":"6pm","price":"1000"}],"price_weekdays_price3":[{"futsal_id":"45","price_id":"3","start_time":"6pm","end_time":"9pm","price":"1500"}],"price_weekend_price1":[{"futsal_id":"45","price_id":"1","start_time":"6pm","end_time":"12pm","price":"1500"}],"price_weekend_price2":[{"futsal_id":"45","price_id":"2","start_time":"12pm","end_time":"6pm","price":"1800"}],"price_weekend_price3":[{"futsal_id":"45","price_id":"3","start_time":"6pm","end_time":"9pm","price":"2000"}],"phone_number_address":[{"futsal_id":"45","futsal_name":"kathmandu futsal","city":"kathmandu","address":"kathmandu","owner_name":"hari prasad","owner_address":"kathmandu","email":"kathmandufutsal@gmail.com","password":"kathmandu","phone_no":"1111111","mobile_no":"9841112233","status":"1"}],"news":[{"futsal_id":"45","news_id":"7","news_title":"asdfasdfasdfasdf","news_description":"asdfashdflahsdlfasdjf;oajsd;ofjaosdijfoaisdjofajsdfja;sjdf;ajsd;fja;ksdjf;kasjd;fkja;sdjf;asjd;fajsd;fjasdjf;asjd;fjas;djf;asdf"},{"futsal_id":"45","news_id":"6","news_title":"awefasdf","news_description":"sdjf;asdf;a;sdf;asjdf;oajsd;fja;sdjf;oajsd;oifjaosdf"},{"futsal_id":"45","news_id":"5","news_title":"asdfasdf","news_description":"sadfasdfasdfasdfa"}]}
i want value of each object futsal_id
, futsal_name
, city , others, in advance!!
it jsonarray within jsonobject
jsonobject json = new jsonobject(response); jsonarray info = json.getjsonarray("info"); //getting first value.. loop if have more 1 jsonobject infoobject = info.getjsonobject(0); jsonarray description = json.getjsonarray("description");
Comments
Post a Comment