Skip to content
Advertisement

Get Json / Resonse body from Curl Post Request in Java

This is the method I have written which sends a POST request to send an Email. I am able to send the email and get the Response Code 200 Ok. But I don’t know how to get the JSON Response and convert it into an Object. Can someone please tell me how to do this?

JavaScript

Advertisement

Answer

A basic search reveals: https://www.baeldung.com/httpurlconnection-post#8-read-the-response-from-input-stream

JavaScript

If the response is in JSON format, use any third-party JSON parsers such as Jackson library, Gson, or org.json to parse the response.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement