Im not quite sure how to go about deserializing the list i'm retrieving from my firebase database.
The fetch:
var x = (await firebase
.Child(ChildName)
.OnceAsync<Userlogin>()).Select(item =>
new Userlogin
{
user_login = item.Object.user_login,
passwords = item.Object.passwords
}).ToList();
The error im getting:
To fix this error either change the JSON to a JSON object (e.g. {"name":"value"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List<T> that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array.
The Error is rather Self explanatory Im just not sure how to approach it, using the current method as its already going to a list so im just not sure
I tried something like :
public async Task<List<Userlogin>> GetAllUser()
{
try
{
var x = (await firebase
.Child(ChildName)
.OnceAsync<Userlogin>()).Select(item =>
new Userlogin
{
user_login = item.Object.user_login,
passwords = item.Object.passwords
}).ToString();
List<Userlogin> datalist = JsonConvert.DeserializeObject<List<Userlogin>>(x);
return datalist;
}
catch (Exception e)
{
Console.WriteLine(e);
Crashes.TrackError(e);
return null;
}
}