I have this structure in Firebase
    "shared_items" : {
    "-KgGHdgE3L_m6ppVgn99" : {
      "_id" : 14,
      "added_date" : "08/Mar/2017",
      "shared_with_emails" : "{\"abc@abc*com\":{\"name\":\"Customer Care\"},\"xyz@xyz*com\":{\"name\":\"Customercare\"}}",
      "user_display_name" : "Logged in user",
      "users_email" : "loggedinUser@gmail.com"
    }
  }
My questions:
- When I am saving JSON data in "shared_with_emails"key then my data is automatically appended with"\"slash. Is this normal or I am doing something wrong here?
- How can I get entire node based on email Ids present in this JSON object.
Function to create JSON objects from provided contacts..
public class JsonUtils {
    final private static String TAG = JsonUtils.class.getSimpleName();
    public String ContactsToJson() {
        ArrayList<ContactsModel> listOfContacts = new ArrayList<>();
        listOfContacts.add(new ContactsModel("abc@gmail.com", "abc"));
        listOfContacts.add(new ContactsModel("xyz@gmail.com", "xyz"));
        listOfContacts.add(new ContactsModel("mnop@yahoo.com", "mnop"));
        JSONObject jsonObjectChild;
        JSONObject jsonObjectRoot = new JSONObject();
        for (int i = 0; i < listOfContacts.size(); i++) {
            ContactsModel model = (ContactsModel) listOfContacts.get(i);
            try {
                jsonObjectChild = new JSONObject();
                jsonObjectChild.put("name", model.getContactName());
                jsonObjectRoot.put(model.getContactMail(), jsonObjectChild);
            } catch (JSONException e){
                e.printStackTrace();
            }
        }
        System.out.println(jsonObjectRoot.toString());
        return jsonObjectRoot.toString();
    }
    public class ContactsModel {
        private int id;
        private String mContactName;
        private String mContactMail;
        public ContactsModel(String contactMail, String contactName) {
            this.mContactName = contactName;
            this.mContactMail = contactMail;
        }
        public String getContactName() {
            return mContactName;
        }
        public String getContactMail() {
            return mContactMail;
        }
    }
}
Json data on Firebase

 
    