I'm trying to parse a a list but I can't find docs on how to do that. I already made my custom adapter class, but when I do the following:
This doesn't work with lists
JsonAdapter<MyData> adapter = moshi.adapter(MyData.class)
This doesn't work
JsonAdapter<List> adapter = moshi.adapter(List.class)
How do I parse a List<MyData> ?
Type listMyData = Types.newParameterizedType(List.class, MyData.class);
JsonAdapter<List<MyData>> adapter = moshi.adapter(listMyData);
This should definitely be in documentation - I just searched for this for like hours.
@janswist it is now :)
How do I do the reverse?
I already have an adapter generated for the class, but not sure how to use it to convert a list of objects to json.
This should definitely be in documentation - I just searched for this for like hours.
Most helpful comment