Hi I am new to the Retrofit 2.0 library, I am having problems parsing some json. I have looked at some other solutions on Stackoverflow but not having much luck with my problem. I am trying to call an api from android with retrofit 2.0.But it is throwing error Expected BEGIN_ARRAY but was BEGIN_OBJECT. Any ..
Category : retrofit
I need to make a java class for handling the response to the alpha vantage API, in this case I’m using TIME_SERIES_INTRADAY, this API returns intraday time series of the equity specified, covering extended trading hours where applicable, below is an example for JSON output { "Meta Data": { "1. Information": "Intraday (5min) open, high, ..
This is the code in which api is call and fetch the data and display in recyler view data and data1 are the deatils of api data but when I am launching the app it is showing blank screen. I want to make a network call using Retrofit, and fetch the list. (URL to fetch ..
I have a retrofit Service: suspend fun getArticles(): Articles and usually I can get response code in try/catch in a case of error. try { val articles = service.getArticles() } catch (e: Exception) { // I can get only codes different from 200… } But what if I need to distinguish between 200 and 202 ..

I can’t understand how to make OAuth 1.0 POST request using Retrofit library in Android. This is the OAuth 1.0 Post request which I made in Postman Help please, I can not understand how to transfer data such as consumer key, consumer secret, callbakurl to the request method, I think it is not supposed to ..

I need to parse only one list of objects from JSON object with Retroft. Here’s my JSON file I need only "similar" array from it. Also I’ve already created POJO for elements of this array Is there a way to make this without making POJO for the rest of the JSON file? Source: Android..
Let’s say I’m getting below response from API {"success":true, "base":"EUR", "date":"2021-04-16", "rates": {"AED":4.393943,"AFN":92.83145,"ALL":123.125765,"AMD":621.059723}} and I want the last rates object to be a List of Rate class i.e. Rate(code="AED", value="4.393943"). I am using Retrofit and Gson. I know I need a Deserializer or a Type Adapter. I just don’t know how to write one. Rate ..
I am getting response of a server, when i log the response body i get the access_token right, but when i try to convert it to a jsonObject it says the string is empty! apiInterface.Login(Email,Pass).enqueue(new Callback<ResponseBody>() { @Override public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) { if(response.isSuccessful()){ try { Log.d("PONSEMONSE",response.body().string()); JSONObject jsonObject = new JSONObject(response.body().string()); Log.d("LONO",jsonObject.getString("access_token")); ..
I have developed an Android application, in that I need to send my videos to the server but the problem is while uploading the videos if I disconnect from the network the upload process was stopped and after I reconnect to the internet it is uploading from starting point, but I want to upload this ..
{"success":true,"rates": {"AT": {"country_name":"Austria","standard_rate":20,"reduced_rates": {"domestic flights":13,"entrance to sporting events":13,"admissions to cultural events and amusement parks":13,"firewood":13,"agricultural supplies":13}},"BE": {"country_name":"Belgium","standard_rate":21,"reduced_rates": {"some foodstuffs":12,"certain agricultural supplies":12,"social housing":12}}}} I tried, @GET("rate_list") fun getValidCountries( @Query("access_key") accessKey: String, ) : Single<Response<JsonElement>> But getting error like, Cannot construct instance of com.google.gson.JsonElement (no Creators, like default construct, exist): abstract types either need to be mapped to ..
Recent Comments