-1

Parse the below JSON Response using Retrofit.

Thanks in advance.

[
{"borrowerId":6,
"borrowerName":"archanaB",
"loanId":"LN3",
"numbersOfEmisPaid":2,
"profit":300.0,
"disburmentAmount":5000.0,
"emisReceived":1967.0
},
{
"borrowerId":6,
"borrowerName":"archanaB",
"loanId":"LN14",
"numbersOfEmisPaid":1,
"profit":150.0,
"disburmentAmount":5000.0,
"emisReceived":983.0
},{
"borrowerId":2,
"borrowerName":"NarendraB",
"loanId":"LN12",
"numbersOfEmisPaid":6,
"profit":175.0,
"disburmentAmount":35000.0,
"emisReceived":36050.0
},
{
"borrowerId":6,
"borrowerName":"archanaB",
"loanId":"LN4",
"numbersOfEmisPaid":18,
"profit":133.0,
"disburmentAmount":5000.0,
"emisReceived":344.0
},
]
Santanu Sur
  • 10,997
  • 7
  • 33
  • 52
  • just go through this simple example and you will get your answer https://www.simplifiedcoding.net/retrofit-android-example/ – sunil kushwah Mar 08 '20 at 06:26

2 Answers2

0

You can use one of the Retrofit2 Converter.Factory -

sunnat629
  • 131
  • 6
0

Convert json to pojo using this site if Java http://www.jsonschema2pojo.org/ if using kotlin https://www.json2kotlin.com/

and use it like that, after implementing you will get Object so no need to parse

 @POST(your_api)
    fun details(
        @QueryName id: Int

    ):
    Observable<yout_model_generated_from_above_link>
Shahzain ali
  • 1,679
  • 1
  • 20
  • 33