Skip to content

Remove curly braces and equal sign from data retrieved from firebase

So, I am using android studio to make an app that displays data stored in firebase real-time database. The app is simple, it displays the name and phone number from firebase to the app.

The app works fine and even displays the data but the only thing is it displays the data/values with curly braces and an equal sign (like a JSON format) is there anyway I can make it display just the desired values and not the extra signs and punctuation

Image of the app screen with the issue is attached


ArrayList<String> list =new ArrayList<>();
ArrayAdapter adapter = new ArrayAdapter<String>(this, R.layout.list_view, list);

DatabaseReference ref= FirebaseDatabase.getInstance().getReference().child("Car Wash");

ref.addValueEventListener(new ValueEventListener() {
    public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
        for(DataSnapshot snapshot: dataSnapshot.getChildren()){

    public void onCancelled(@NonNull DatabaseError databaseError) {



What you’re seeing is the toString() output of the value a Firebase DataSnapshot that represents an object with multiple values.

You’ll want to get the individual values from that snapshot, and display their values with something like this:

String name = snapshot.child("Name").getValue(String.class);
String phoneNr = snapshot.child("Phone Number").getValue(String.class);
list.add(name+" ("+phoneNr+")");