I would like to modify the request body before it reaches to Http Servlet and gets processed.The JSON Payload of the Request body is like following and I would like to get rid of the "PayamtChqmanViewObject" (Detail) part.
{
      "ChqAccCode": "1",
      "ChqAmt": 1,
      "ChqBankCompCode": "TEST",
      "ChqBchName": "TEST",
      "ChqBchPost": "Y",
      "ChqPostDate":"2020-08-14",
      "ChqCompCode": "TEST",
      "ChqDate": "2020-04-21",
      "ChqDeptCode": "0",
      "ChqDesc": "TEST",
      "ChqDraftCode": "M",
      "ChqJobCode": null,
      "ChqJointVenName": null,
      "ChqNum": 123,
      "ChqPayeeAddr1": "Rome",
      "ChqPayeeAddr2": "1",
      "ChqPayeeAddr3": "Rome",
      "ChqPayeeCountry": "Italy",
      "ChqPayeeName1": "A1",
      "ChqPayeeName2": null,
      "ChqPayeePostalCode": "85695",
      "ChqPayeeRegCode": "IT",
      "ChqRecCode": "O",
      "ChqSeqNum": "1",
      "ChqVenCode": "ZZ",
      "ChqVouCode": null,
      "PayamtChqmanViewObj":[
        {
          "PaCompCode": "ZZ",
          "PaChqCompCode": "ZZ",
          "PaVenCode": "ACME",
          "PaChqNum": 123,
          "PaPayCurrAmt": 1,
          "PaAmt": 1,
          "PaVouInvCode": "INV001",
          "PaDiscAmt": 0,
          "PaChqSeqNum": "1"
        }
   ]
}
I am able to get the Request Body with using following method, however I am not sure how to delete the detail part of the JSON and pass the processed request body to HTTP Servlet.
 public static String getBody(HttpServletRequest request) throws IOException {
        String body = null;
        StringBuilder stringBuilder = new StringBuilder();
        BufferedReader bufferedReader = null;
        try {
            InputStream inputStream = request.getInputStream();
            if (inputStream != null) {
                bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
                char[] charBuffer = new char[128];
                int bytesRead = -1;
                while ((bytesRead = bufferedReader.read(charBuffer)) > 0) {
                    stringBuilder.append(charBuffer, 0, bytesRead);
                }
            } else {
                stringBuilder.append("");
            }
        } catch (IOException ex) {
            throw ex;
        } finally {
            if (bufferedReader != null) {
                try {
                    bufferedReader.close();
                } catch (IOException ex) {
                    throw ex;
                }
            }
        }
        body = stringBuilder.toString();
        System.out.println("BODY IS:" + body);
        return body;
    }
Thank you very much for the help!
 
    