But i keep getting getTrendingList onFailure Respo...
# android
g
But i keep getting getTrendingList onFailure Response java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2 path $
l
@g4sarma Missing details there, but my guess is that you're using Moshi, and that it is not really Android related (even if you use it in an Android app). I'd post the question with proper details on StackOverflow, and if you don't get a good answer, post the link in #squarelibraries
m
most likely there is an issue with
TrendingRepository
can you post that as well?
g
data class TrendingRepository( val id: Int, val node_id: String, val name: String, val full_name: String, val owner: Owner, val private: Boolean, val html_url: String, val description: String, val fork: Boolean, val url: String, val forks_url: String, val keys_url: String, val collaborators_url: String, val teams_url: String, val hooks_url: String, val issue_events_url: String, val events_url: String, val assignees_url: String, val branches_url: String, val tags_url: String, val blobs_url: String, val git_tags_url: String, val git_refs_url: String, val trees_url: String, val statuses_url: String, val languages_url: String, val stargazers_url: String, val contributors_url: String, val subscribers_url: String, val subscription_url: String, val commits_url: String, val git_commits_url: String, val comments_url: String, val issue_comment_url: String, val contents_url: String, val compare_url: String, val merges_url: String, val archive_url: String, val downloads_url: String, val issues_url: String, val pulls_url: String, val milestones_url: String, val notifications_url: String, val labels_url: String, val releases_url: String, val deployments_url: String, val created_at: String, val updated_at: String, val pushed_at: String, val git_url: String, val ssh_url: String, val clone_url: String, val svn_url: String, val homepage: String, val size: Int, val stargazers_count: Int, val watchers_count: Int, val language: String, val has_issues: Boolean, val has_projects: Boolean, val has_downloads: Boolean, val has_wiki: Boolean, val has_pages: Boolean, val forks_count: Int, val mirror_url: String?, val archived: Boolean, val open_issues_count: Int, val license: License, val forks: Int, val open_issues: Int, val watchers: Int, val default_branch: String, val score: Double )
data class Owner( val login: String, val id: Int, val node_id: String, val avatar_url: String, val gravatar_id: String, val url: String, val html_url: String, val followers_url: String, val following_url: String, val gists_url: String, val starred_url: String, val subscriptions_url: String, val organizations_url: String, val repos_url: String, val events_url: String, val received_events_url: String, val type: String, val site_admin: Boolean )
data class License( val key: String, val name: String, val spdx_id: String, val url: String, val node_id: String )
@martin.petrulak
p
@g4sarma Just keep removig properties till you find the one causing the issue
👍 1
g
@Paul Woitaschek sounds like a plan
p
Set a breakpoint to com.squareup.moshi.JsonAdapter to verify the raw data
g
I am not using moshi
b
Which library are you using to convert JSON to your model? And did you write your adapter class?
r
Not kotlin related. But the error says your Json has a array at the beginning but the way you set up your models, doesnt reflect that. Try putting the json into a json to pojo converter , it probably has a model of a single list
m
and what that error is saying that you are putting an array into an object, so just check what properties are arrays in the response and update it
g
@BMG I am using the JSONtoKotlinDataClasss plugin
for android studio
Thank you guys for all your responses but the issue was with the API i resolved it 🙂