I have dynamic JSON, here is example: http://pastebin.com/QMWRZTrD
How I can parse it with Retrofit?
I failed to generate POJO classes, since I have dynamic
You can get retrofit api call to return String in your RestApi Interface like
Call method(@Path(..)...);
And for that to work you would need to add the scalars converter factory to where you create your Retrofit object. First you would need to import it:
compile 'com.squareup.retrofit2:converter-scalars:2.1.0'
And then add it:
Retrofit retrofit = new Retrofit.Builder()
.addConverterFactory(ScalarsConverterFactory.create())
.addConverterFactory(GsonConverterFactory.create())
.baseUrl("https://your.base.url/")
.build();
And then in onResponse
public void onResponse(Call call, Response response) {
if (response.isSuccessful()) {
Type mapType = new TypeToken
Also,check out this site it has great tutorials on Retrofit.