All I need is the "photo" array. My JSON looks like this:
{
"photos": {
"page": 1,
"pages": "1000",
"perpage": 1,
"total": "1000",
"photo": [
{
"id": "44049202615",
"owner": "159796861@N07",
"secret": "cb8f476a4d",
"server": "1958",
"farm": 2,
"title": "Murugan",
"ispublic": 1,
"isfriend": 0,
"isfamily": 0
}
]
},
"stat": "ok"
}
I'm new to Moshi/Retrofit. I saw this but I don't quite understand yet how to make that work. I thought I could do something quick and dirty to get the values I need so I can continue to build out my app (I'll go back later for a proper implementation).
My quick and dirty idea was this:
data class GalleryItem(@Json(name = "title") val caption: String,
@Json(name = "id") val id: String,
@Json(name = "url_s") val url: String?)
data class Photo(@Json(name = "photo") val galleryItems: List<GalleryItem>)
data class Photos(@Json(name = "photos") val photo: Photo)
I thought I could just return a "Photos" from my api and grab the gallery items. There's no crashes but it's not parsing correctly. I get the "Photos" object but "Photo" is null.
Any thoughts on how to access the data I need?