Using Firebase Library to send data to the server in the form Message(String, String) added to the HashMap
Exampl
Use this code if you want to convert firebase object to json using Gson Library :
databaseReference.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
Object object = dataSnapshot.getValue(Object.class);
String json = new Gson().toJson(object);
Example example= new Gson().fromJson(json, Example.class);
Log.e("json","json: " + example.getGlossary());
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
This will convert complete Database Structure to String json and then json to class object using Gson Lib