Can you create a type adapter in Moshi that will analyze both an object and a list of objects of the same type?
For example, sometimes JSON:
{
"person": {...}
}
In other cases, these are:
{
"person": [{...}, {...}]
}
Ideally, I want the Java object to look like this:
class PersonContainer {
@PersonsList List<Person> persons; // @List(Person.class) would be even better
}
source
share