Multiple array with same object name in JSON Array in android? -


in application j son response

{ "orderdetails": [     {         "order_details": {             "branch_code": 0,             "cust_code": 87,             "custom_instructions": "<null>",             "merchant_code": "<null>",             "order_number": 419,             "order_type_code": 1,             "packing_charge": 0,             "price": 200,             "product_code": 21,             "quantity": 1,             "value": 200         },         "order_headers": {             "branch_code": 0,             "cust_code": 87,             "delivered_time": "<null>",             "delivery_charge": 23,             "delivery_date": "2013-05-02",             "delivery_support": "",             "delivery_time": "12:52:25",             "grand_total": 354,             "merchant_code": "<null>",             "order_datetime": "2013-05-02 12:52:25",             "order_status": "pending",             "order_type_code": 1,             "order_value": 354,             "packing_charge": 0,             "payment_status": "pending",             "payment_type": "cash",             "sub_total": 325,             "vat_percent": 7         }     },     {         "order_details": {             "branch_code": 0,             "cust_code": 87,             "custom_instructions": "<null>",             "merchant_code": "<null>",             "order_number": 419,             "order_type_code": 1,             "packing_charge": 0,             "price": 125,             "product_code": 35,             "quantity": 1,             "value": 125         },         "order_headers": {             "branch_code": 0,             "cust_code": 87,             "delivered_time": "<null>",             "delivery_charge": 23,             "delivery_date": "2013-05-02",             "delivery_support": "",             "delivery_time": "12:52:25",             "grand_total": 354,             "merchant_code": "<null>",             "order_datetime": "2013-05-02 12:52:25",             "order_status": "pending",             "order_type_code": 1,             "order_value": 354,             "packing_charge": 0,             "payment_status": "pending",             "payment_type": "cash",             "sub_total": 325,             "vat_percent": 7         }     } ], "ordersuccess": 1 } 

i want put order_details in single array list,i don't know how solve problem.can 1 know please me solve problem.

// convert string json object jsonobject json = new jsonobject(responsestring);  // order_details json object jsonobject json_order_details = json.getjsonobject("order_details");  // value ll json object  myarraylist1.add(json_order_details.getstring("branch_code")); myarraylist2.add(json_order_details.getstring("cust_code")); myarraylist3.add(json_order_details.getstring("order_number")); myarraylist4.add(json_order_details.getstring("price")); . .  . 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -