Get json object without param name in android -


i have json response this:

array (   'status' => 'ok',   'categories' =>    array (     'sepeda' =>      array (       83 => 'sepeda mtb',       'fullbike' =>        array (         370 => 'mtb',         371 => 'roadbike',         374 => 'fixie',         375 => 'sepeda lipat',         378 => 'city bike',         380 => 'bmx',         382 => 'onthel',       ),       84 => 'sepeda lipat',       'frame' =>        array (         372 => 'mtb',         373 => 'roadbike',         376 => 'fixie',         384 => 'sepeda lipat',         379 => 'city bike',         381 => 'bmx',         383 => 'onthel',       ),  

how can array array "sepeda mtb" , "sepeda lipat" , etc

as know , json doesn't have parameter names "value" or "name" usual . json response not short , other values after that.

and when use code

jsonobject cate = json.getjsonobject("categories");                 jsonobject = cate.getjsonobject(secid);                 log.e("a", a.tostring()); 

this logcat show this

> 05-20 16:38:42.840: e/a(3869): {"143":"road bike","144":"kids & city > bike","fullbike":{"370":"mtb","378":"city > bike","371":"roadbike","382":"onthel","375":"sepeda > lipat","380":"bmx","374":"fixie"},"96":"helm & body > protection","145":"onthel","wheel (hub, rims, dll)":{"262":"ban > dalam","263":"hub & freehub","261":"ban > luar","265":"spokes","360":"quick release","264":"rims","348":"wheel > set"},"95":"tas sepeda","94":"sepatu sepeda","138":"part > generik","93":"part lain","outwear":{"275":"jersey, glove & > pants","280":"tas","276":"helm & topi ","277":"sepatu","278":"body > protector","279":"goggle \/ kacamata","359":"bandana & > masker"},"91":"jersey, shorts & pants","equipment & > tools":{"357":"speedometer","358":"stickers & decals","270":"rack & > panniers","269":"bottle & cage","268":"lampu \/ senter","361":"fender > \/ mudguard","272":"carrier, hanger, & bike > stand","267":"bel","271":"pompa","266":"gembok","273":"tools & > others"},"fork & > suspension":{"353":"fork","355":"suspension"},"83":"sepeda > mtb","frame":{"383":"onthel","379":"city bike","384":"sepeda > lipat","381":"bmx","372":"mtb","373":"roadbike","376":"fixie"},"drivetrain":{"349":"group > set","136":"part drivetrain lain","258":"bottom bracket","90":"hub & > free hub","257":"pedal, toeclip, & strap","259":"rantai","254":"front > derailleur (fd)","253":"rear derailleur (rd)","256":"sprocket & > gear","88":"crank","255":"crank & chainring"},"86":"fork & > shock","87":"wheel & tire","control & brake":{"250":"seatpost & > clamp","251":"saddle","252":"headset & spacer","369":"cable & > housing","245":"brake set","249":"hand grip \/ bar tape","362":"bar > end \/ > tanduk","248":"shifter","247":"handlebar","246":"stem"},"142":"bmx","84":"sepeda > lipat","89":"brake & rotor","141":"sepeda fixie"} 

i've solution , solutin

jsonobject cate = json.getjsonobject("categories");                 jsonobject = cate.getjsonobject(secid);                  //get list of keys                 iterator<string> keys=a.keys();                 while(keys.hasnext()){                     string key=keys.next();                     string value=a.getstring(key);                     log.e("key", key);                     log.e("value", value);                 } 

thanks :)

try

//result server jsonobject obj=json object //get list of keys iterator<string> keys=obj.keys(); while(keys.hasnext()) { string key=keys.next(); string value=obj.getstring(key); } 

Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -