I have this json object of key value pairs that needs to be sent in a post request using retrofit
{
"Criteria":{
"DisciplineId":0,
"SeasonId":0,
"Leagues":[
],
"StartDate":"06 Sep 2013",
"EndDate":"14 Dec 2013",
"RoundId":0,
"GroupId":0,
"MatchesScores":3
},
"SearchInfo":{
"PageNumber":1,
"PageSize":20,
"Sort":1,
"TotalRecords":542
}
}
I was thinking of creating a POJO that matches the gson definition of the json object then using the setters in the POJO class to set the value for each key value pair.
So I would have something like this
@FormUrlEncoded
@POST("/getMatches")
void getMatches(@Field("Criteria") Criteria criteria,@Field("SearchInfo") SearchInfo searchInfo, Callback<JSONKeys> keys);
Am I on the right track?
How can I achieve this seeing that there are two nested json objects within the json object as well as a json array with one of these objects?