Json Object Code

PHOTO EMBED

Sat Oct 24 2020 09:04:52 GMT+0000 (Coordinated Universal Time)

Saved by @mabdelsattar92 #java

 final JSONObject jsonBody = new JSONObject();


                        JSONObject RecieverInfo = new JSONObject();

                        RecieverInfo.put("FullName",recivername.getText().toString());
                        RecieverInfo.put("Phone2",reciverphoneksa.getText().toString());
                        RecieverInfo.put("Phone1",reciverphoneegy.getText().toString());

                        JSONObject Address1_R = new JSONObject();
                        Address1_R.put("CityId", recieverCities.get(spinner_Reciever_address_city.getSelectedItemPosition()));
                        Address1_R.put("AddressText", reciveraddressdetail.getText().toString());

                        RecieverInfo.put("Address1",Address1_R);
//                RecieverInfo.put("NationalID",mpreference.getReciverNationalId());

                        jsonBody.put("RecieverInfo",RecieverInfo);

                        JSONObject ClientInfo = new JSONObject();

                        ClientInfo.put("FullName",clientname.getText().toString());
                        ClientInfo.put("Phone2",clientphoneegy.getText().toString());
                        ClientInfo.put("Phone1",clientphoneksa.getText().toString());
                        if(clientemail.getText() != null )
                        ClientInfo.put("Email",clientemail.getText().toString());
                        else
                            ClientInfo.put("Email","");

                        JSONObject Address1_C = new JSONObject();
                        Address1_C.put("CityId", clientCities.get(spinner_client_address_city.getSelectedItemPosition()));
//                Address1_C.put("AddressText", mpreference.getClientAddressDetial());

                        ClientInfo.put("Address1",Address1_C);
                        ClientInfo.put("NationalID",clientnationalid.getText().toString());
//                ClientInfo.put("Nationality",mpreference.getClientNationality());

                        jsonBody.put("ClientInfo",ClientInfo);
content_copyCOPY