I use charles proxy tool to monitor the requests and response.
Although I can use the export feature of charles proxy tool to extract the complete file as a .chls file. As shown in the below picture,
That .chls file will have the URL, request headers, request body, response header, response body and many other details.
But what I need is only the request body to be saved as a .json file. Is there anyway that I can automate this process?
Go to Charles > Proxy Tab > Enable the Web Interface:
After completing charles session you can launch http://control.charles/session/export-json url to get the JSON format of the request.
To automate this you can use curl command:
Runtime.getRuntime().exec("curl -o file.json http://control.charles/session/export-csv");