arrays - How can i iterate the below Object Value in android -
how can loop following value showing below
e/value: {date=29-07-2017, reciept=rc1, amount=11800} 08-18 12:19:07.568 30246-30246/com.bitblue.dextronewproject e/value: {heading={date=29-07-2017, reciept=rc1, amount=11800}, details=[{updated_at=2017-06-30 14:08:30, is_cheq_msg_send=0, discount=0, bank_name=, date=2017-06-30, cheque_date=0000-00-00, late_fee=0, cheque_num=0, bal=0, fee_type=bus fee, year=2017, cheq_msg=, pay_mode=cash, amount=100, gr_num=1355, unique_id=75, lflag=yes, reciept=rc1, created_at=2017-06-30 14:08:30, reason=, is_active=1, month=aug}, {updated_at=2017-07-29 12:20:52, is_cheq_msg_send=0, discount=0, bank_name=, date=2017-07-29, cheque_date=0000-00-00, late_fee=0, cheque_num=0, bal=0, fee_type=monthly fee, year=2017, cheq_msg=, pay_mode=cash, amount=1000, gr_num=1355, unique_id=65, lflag=no, reciept=rc1, created_at=2017-07-29 12:20:52, reason=, is_active=1, month=aug}, {updated_at=2017-07-29 12:20:52, is_cheq_msg_send=0, discount=0, bank_name=, date=2017-07-29, cheque_date=0000-00-00, late_fee=0, cheque_num=0, bal=0, fee_type=bus fee, year=2017, cheq_msg=, pay_mode=cash, amount=100, gr_num=1355, unique_id=65, lflag=no, reciept=rc1, created_at=2017-07-29 12:20:52, reason=, is_active=1, month=dec}, {updated_at=2017-07-29 12:21:12, is_cheq_msg_send=0, discount=0, bank_name=, date=2017-07-29, cheque_date=0000-00-00, late_fee=0, cheque_num=0, bal=0, fee_type=monthly fee, year=2017, cheq_msg=, pay_mode=cash, amount=1000, gr_num=1355, unique_id=65, lflag=no, reciept=rc1, created_at=2017-07-29 12:21:12, reason=, is_active=1, month=dec}, {updated_at=2017-07-29 12:21:12, is_cheq_msg_send=0, discount=0, bank_name=, date=2017-07-29, cheque_date=0000-00-00, late_fee=0, cheque_num=0, bal=0, fee_type=bus fee, year=2017, cheq_msg=, pay_mode=cash, amount=100, gr_num=1355, unique_id=65, lflag=no, reciept=rc1, created_at=2017-07-29 12:21:12, reason=, is_active=1, month=feb}, {updated_at=2017-06-30 14:08:30, is_cheq_msg_send=0, discount=0, bank_name=, date=2017-06-30, cheque_date=0000-00-00, late_fee=0, cheque_num=0, bal=0, fee_type=monthly fee, year=2017, cheq_msg=, pay_mode=cash, amount=1000, gr_num=1355, unique_id=75, lflag=no, reciept=rc1, created_at=2017-06-30 14:08:30, reason=, is_active=1, month=term 1}, {updated_at=2017-06-30 14:08:30, is_cheq_msg_send=0, discount=0, bank_name=, date=2017-06-30, cheque_date=0000-00-00, late_fee=0, cheque_num=0, bal=3000, fee_type=one time, year=2017, cheq_msg=, pay_mode=cash, amount=7000, gr_num=1355, unique_id=75, lflag=no, reciept=rc1, created_at=2017-06-30 14:08:30, reason=, is_active=1, month=admission fee}, {updated_at=2017-07-29 12:20:52, is_cheq_msg_send=0, discount=0, bank_name=, date=2017-07-29, cheque_date=0000-00-00, late_fee=0, cheque_num=0, bal=1500, fee_type=one time, year=2017, cheq_msg=, pay_mode=cash, amount=1500, gr_num=1355, unique_id=65, lflag=no, reciept=rc1, created_at=2017-07-29 12:20:52, reason=, is_active=1, month=admission fee}]} 08-18 12:19:07.568 30246-30246/com.bitblue.dextronewproject e/value: {date=30-06-2017, reciept=rc2, amount=200} 08-18 12:19:07.573 30246-30246/com.bitblue.dextronewproject e/value: {heading={date=30-06-2017, reciept=rc2, amount=200}, details=[{updated_at=2017-07-29 12:20:52, is_cheq_msg_send=0, discount=0, bank_name=, date=2017-07-29, cheque_date=0000-00-00, late_fee=0, cheque_num=0, bal=0, fee_type=bus fee, year=2017, cheq_msg=, pay_mode=cash, amount=100, gr_num=1355, unique_id=65, lflag=no, reciept=rc2, created_at=2017-07-29 12:20:52, reason=, is_active=1, month=jan}, {updated_at=2017-06-30 14:08:30, is_cheq_msg_send=0, discount=0, bank_name=, date=2017-06-30, cheque_date=0000-00-00, late_fee=0, cheque_num=0, bal=0, fee_type=bus fee, year=2017, cheq_msg=, pay_mode=cash, amount=100, gr_num=1355, unique_id=75, lflag=yes, reciept=rc2, created_at=2017-06-30 14:08:30, reason=, is_active=1, month=jul}]} 08-18 12:19:07.573 30246-30246/com.bitblue.dextronewproject e/value: {date=30-06-2017, reciept=rc3, amount=1100} 08-18 12:19:07.573 30246-30246/com.bitblue.dextronewproject e/value: {heading={date=30-06-2017, reciept=rc3, amount=1100}, details=[{updated_at=2017-06-30 14:08:30, is_cheq_msg_send=0, discount=0, bank_name=, date=2017-06-30, cheque_date=0000-00-00, late_fee=0, cheque_num=0, bal=0, fee_type=monthly fee, year=2017, cheq_msg=, pay_mode=cash, amount=1000, gr_num=1355, unique_id=75, lflag=no, reciept=rc3, created_at=2017-06-30 14:08:30, reason=, is_active=1, month=jul}, {updated_at=2017-06-30 14:08:30, is_cheq_msg_send=0, discount=0, bank_name=, date=2017-06-30, cheque_date=0000-00-00, late_fee=0, cheque_num=0, bal=0, fee_type=bus fee, year=2017, cheq_msg=, pay_mode=cash, amount=100, gr_num=1355, unique_id=75, lflag=yes, reciept=rc3, created_at=2017-06-30 14:08:30, reason=, is_active=1, month=jun}]} 08-18 12:19:07.573 30246-30246/com.bitblue.dextronewproject e/value: {date=29-07-2017, reciept=rc4, amount=2100} 08-18 12:19:07.578 30246-30246/com.bitblue.dextronewproject e/value: {heading={date=29-07-2017, reciept=rc4, amount=2100}, details=[{updated_at=2017-07-29 12:20:52, is_cheq_msg_send=0, discount=0, bank_name=, date=2017-07-29, cheque_date=0000-00-00, late_fee=0, cheque_num=0, bal=0, fee_type=monthly fee, year=2017, cheq_msg=, pay_mode=cash, amount=1000, gr_num=1355, unique_id=65, lflag=no, reciept=rc4, created_at=2017-07-29 12:20:52, reason=, is_active=1, month=jun}, {updated_at=2017-07-29 12:20:52, is_cheq_msg_send=0, discount=0, bank_name=, date=2017-07-29, cheque_date=0000-00-00, late_fee=0, cheque_num=0, bal=0, fee_type=bus fee, year=2017, cheq_msg=, pay_mode=cash, amount=100, gr_num=1355, unique_id=65, lflag=no, reciept=rc4, created_at=2017-07-29 12:20:52, reason=, is_active=1, month=nov}, {updated_at=2017-07-29 12:21:12, is_cheq_msg_send=0, discount=0, bank_name=, date=2017-07-29, cheque_date=0000-00-00, late_fee=0, cheque_num=0, bal=0, fee_type=monthly fee, year=2017, cheq_msg=, pay_mode=cash, amount=1000, gr_num=1355, unique_id=65, lflag=no, reciept=rc4, created_at=2017-07-29 12:21:12, reason=, is_active=1, month=nov}]} 08-18 12:19:07.578 30246-30246/com.bitblue.dextronewproject e/value: {date=29-07-2017, reciept=rc5, amount=3200} 08-18 12:19:07.578 30246-30246/com.bitblue.dextronewproject e/value: {heading={date=29-07-2017, reciept=rc5, amount=3200}, details=[{updated_at=2017-06-30 14:08:30, is_cheq_msg_send=0, discount=0, bank_name=, date=2017-06-30, cheque_date=0000-00-00, late_fee=0, cheque_num=0, bal=0, fee_type=bus fee, year=2017, cheq_msg=, pay_mode=cash, amount=100, gr_num=1355, unique_id=75, lflag=yes, reciept=rc5, created_at=2017-06-30 14:08:30, reason=, is_active=1, month=oct}, {updated_at=2017-07-29 12:20:52, is_cheq_msg_send=0, discount=0, bank_name=, date=2017-07-29, cheque_date=0000-00-00, late_fee=0, cheque_num=0, bal=0, fee_type=monthly fee, year=2017, cheq_msg=, pay_mode=cash, amount=1000, gr_num=1355, unique_id=65, lflag=no, reciept=rc5, created_at=2017-07-29 12:20:52, reason=, is_active=1, month=oct}, {updated_at=2017-06-30 14:08:30, is_cheq_msg_send=0, discount=0, bank_name=, date=2017-06-30, cheque_date=0000-00-00, late_fee=0, cheque_num=0, bal=0, fee_type=bus fee, year=2017, cheq_msg=, pay_mode=cash, amount=100, gr_num=1355, unique_id=75, lflag=yes, reciept=rc5, created_at=2017-06-30 14:08:30, reason=, is_active=1, month=sep}, {updated_at=2017-06-30 14:08:30, is_cheq_msg_send=0, discount=0, bank_name=, date=2017-06-30, cheque_date=0000-00-00, late_fee=0, cheque_num=0, bal=0, fee_type=monthly fee, year=2017, cheq_msg=, pay_mode=cash, amount=1000, gr_num=1355, unique_id=75, lflag=no, reciept=rc5, created_at=2017-06-30 14:08:30, reason=, is_active=1, month=sep}, {updated_at=2017-07-29 12:21:12, is_cheq_msg_send=0, discount=0, bank_name=, date=2017-07-29, cheque_date=0000-00-00, late_fee=0, cheque_num=0, bal=0, fee_type=monthly fee, year=2017, cheq_msg=, pay_mode=cash, amount=1000, gr_num=1355, unique_id=65, lflag=no, reciept=rc5, created_at=2017-07-29 12:21:12, reason=, is_active=1, month=term 2}]}
here code
public map<string, object> tomap(jsonobject fees_history) throws jsonexception { map<string, object> map = new hashmap<string, object>(); jsonarray = new jsonarray(); int j = 0; iterator<string> keysitr = fees_history.keys(); while (keysitr.hasnext()) { string key = keysitr.next().tostring(); log.e("key", key); object value = fees_history.get(key); if (value instanceof jsonarray) { value = tolist((jsonarray) value); } else if (value instanceof jsonobject) { value = tomap((jsonobject) value); log.e("value",value.tostring()); } map.put(key, value); } return map; } public list<object> tolist(jsonarray array) throws jsonexception { list<object> list = new arraylist<object>(); (int = 0; < array.length(); i++) { object valuenew = array.get(i); if (valuenew instanceof jsonarray) { valuenew = tolist((jsonarray) valuenew); } else if (valuenew instanceof jsonobject) { valuenew = tomap((jsonobject) valuenew); } list.add(valuenew); } return list; }
when try amount or string single element these value please can 1 me iterate value. because of there issue in iterating , fetching complete value in array or loop
Comments
Post a Comment