I'm trying to create a simple Jersey client to process data from a public API.
Using the below program, Im able to read and process the data but I want to convert the JSON response to Java Object so that I have a structure.
How do I build the Java object structure based on the response.
public class RestServiceClient {
public static void main(String[] args) {
Client client = Client.create();
WebResource webResource2 = client.resource("https://data.montgomerycountymd.gov/api/views/54rh-89p8/rows.json?accessType=DOWNLOAD");
ClientResponse response2 = webResource2.accept("application/json").get(ClientResponse.class);
if (response2.getStatus() != 200) {
throw new RuntimeException("Failed : HTTP error code : " + response2.getStatus());
}
String output2 = response2.getEntity(String.class);
System.out.println(output2);
}
}