I'm scraping a web api with this Java code:
import kong.unirest.HttpResponse;
import kong.unirest.Unirest;
import kong.unirest.json.JSONObject;
public class Scr {
public static void main(String[] args) {
Unirest.config().enableCookieManagement(false);
HttpResponse<String> response = Unirest.post("https://www.cse.lk/api/financials")
.header("content-type", "application/x-www-form-urlencoded; charset=UTF-8")
.body("symbol=DIPD.N0000")
.asString();
JSONObject json = new JSONObject(response.getBody());
//System.out.println(json.toString(4));
}
}
which throws a json that looks like this: https://pastebin.com/ZqqB5H8C
What I want to figure out is how to deserialize the json into a java object. This is the encapsulated bean I wrote to deserialize the json.
public class ComData {
private List<FileData> infoAnnualData = new ArrayList<FileData>();
private List<FileData> infoQuarterlyData = new ArrayList<FileData>();
private List<FileData> infoOtherData = new ArrayList<FileData>();
private List<InfoWebLink> infoWebLink = new ArrayList<InfoWebLink>();
private List<ReqFinancial> reqFinancial = new ArrayList<ReqFinancial>();
private InfoCompanyBannerAd infoCompanyBannerAd;
// getters and setters goes here
}