I have been trying to convert a String array from Firebase to an actual array but it comes as a single string from Firebase.
To clarify it, this is what I have on Firebase:
And I am trying to retrieve those Dates and Convert them to an Array, as they become a single string which makes it very difficult to separate into different dates.
I have tried to replace the quotation of the string as indicatedhere, hoping to get the square brackets only and use that a array, since I'll be having an array[], which I succeeded in doing but converting the array to list shows double square brackets as seen below.
06-22 13:35:18.241 10352-10352/com.angelserve.zacktinga.angelserv I/System.out: LIST ARRAY: [[Sat Jun 30 00:00:00 GMT+02:00 2018, Sat Jun 30 00:00:00 GMT+02:00 2018, Sun Jul 01 00:00:00 GMT+02:00 2018, Mon Jul 02 00:00:00 GMT+02:00 2018, Tue Jul 03 00:00:00 GMT+02:00 2018, Wed Jul 04 00:00:00 GMT+02:00 2018, Thu Jul 05 00:00:00 GMT+02:00 2018, Fri Jul 06 00:00:00 GMT+02:00 2018, Sat Jul 07 00:00:00 GMT+02:00 2018]]
I am getting the dates a DataSnapshot from firebase like below:
mCurrentUserRefDatabase.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
System.out.println("DATE LIST: " + dataSnapshot.child("requested_dates").getValue());
dates.replace("\"", "");
List<String> list = Arrays.asList(dates);
System.out.println("LIST ARRAY: " + list);
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
What I need as a solution is a way to convert my firebase datasnapshot of
requested_dates
and convert them into a working array.

