{"action":"created","issue":{"url":"https://api.github.com/repos/square/retrofit/issues/1764","repository_url":"https://api.github.com/repos/square/retrofit","labels_url":"https://api.github.com/repos/square/retrofit/issues/1764/labels{/name}","comments_url":"https://api.github.com/repos/square/retrofit/issues/1764/comments","events_url":"https://api.github.com/repos/square/retrofit/issues/1764/events","html_url":"https://github.com/square/retrofit/issues/1764","id":151471205,"number":1764,"title":"Dynamically named top level json object","user":{"login":"Orbyt","id":8474654,"avatar_url":"https://avatars.githubusercontent.com/u/8474654?v=3","gravatar_id":"","url":"https://api.github.com/users/Orbyt","html_url":"https://github.com/Orbyt","followers_url":"https://api.github.com/users/Orbyt/followers","following_url":"https://api.github.com/users/Orbyt/following{/other_user}","gists_url":"https://api.github.com/users/Orbyt/gists{/gist_id}","starred_url":"https://api.github.com/users/Orbyt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Orbyt/subscriptions","organizations_url":"https://api.github.com/users/Orbyt/orgs","repos_url":"https://api.github.com/users/Orbyt/repos","events_url":"https://api.github.com/users/Orbyt/events{/privacy}","received_events_url":"https://api.github.com/users/Orbyt/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-04-27T19:30:01Z","updated_at":"2016-04-27T19:40:59Z","closed_at":"2016-04-27T19:31:41Z","body":"I am using Retrofit to make an api call. The top level object is named depending on the query parameters of the request. For example, a request like this:\r\n\r\n`api.somewebsite.com/1.0/mix_info?mix_id=69`\r\n\r\nreturns a response like this:\r\n\r\n    {\"69\":{\r\n        \"mix_id\":\"69\",\r\n        \"mix_title\":\"A Title\",\r\n        \"mix_file\":\"https:example.com/mp3\",\r\n        \"mix_genres\":\"House,Pop\",\r\n        \"mix_dj_id\":\"57\",\r\n        \"number_votes\":\"390\",\r\n        \"station\":\"1\" \r\n        }\r\n    }\r\n\r\nHeres a screenie as well that kinda shows the format:\r\nhttp://prnt.sc/axltcd\r\n\r\nBasically, depending on the number passed into the url `mix_id=` query becomes the name of the top level json object returned in the response.\r\n\r\n\r\nI was able to hack together something that kinda works:\r\n\r\nI have a model Response class which has a member variable that is the top level object, and I use Retrofit's @SerializedName(\"69\") to explicity set the name. This, of course, will only work for a request with the id of 69, otherwise the response returns null object.\r\n\r\nIt looks like this:\r\n\r\n    public class Response {\r\n        \r\n         @SerializedName(\"69\")\r\n         private _69 _69;\r\n    }\r\n\r\nIs there a built in feature in Retrofit to handle these cases?\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/square/retrofit/issues/comments/215205281","html_url":"https://github.com/square/retrofit/issues/1764#issuecomment-215205281","issue_url":"https://api.github.com/repos/square/retrofit/issues/1764","id":215205281,"user":{"login":"Orbyt","id":8474654,"avatar_url":"https://avatars.githubusercontent.com/u/8474654?v=3","gravatar_id":"","url":"https://api.github.com/users/Orbyt","html_url":"https://github.com/Orbyt","followers_url":"https://api.github.com/users/Orbyt/followers","following_url":"https://api.github.com/users/Orbyt/following{/other_user}","gists_url":"https://api.github.com/users/Orbyt/gists{/gist_id}","starred_url":"https://api.github.com/users/Orbyt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Orbyt/subscriptions","organizations_url":"https://api.github.com/users/Orbyt/orgs","repos_url":"https://api.github.com/users/Orbyt/repos","events_url":"https://api.github.com/users/Orbyt/events{/privacy}","received_events_url":"https://api.github.com/users/Orbyt/received_events","type":"User","site_admin":false},"created_at":"2016-04-27T19:40:59Z","updated_at":"2016-04-27T19:40:59Z","body":"Ah, was under the impression `@SerializedName` was from Retrofit, it instead is from Gson. Thanks regardless."}}