Blog Archive for August 17, 2017

HTTP Client 4 and a JSON endpoint

August 17, 2017

I need to POST to a HTTPS JSON based service endpoint in Java. I can do this using Http Client 4.

In the following code, SERVICE_ENDPOINT is the full URL to the service, in my case https://" + SERVICE_HOST + "/v2/. The other values should be self explanatory, and are all strings ...

Parse JSON with Jackson

August 17, 2017

I wanted to parse a small JSON response message in Java, using the Jackson library - version 2.4.5.

The code is as follows, where pJsonResponse is the passed in JSON to parse:

ObjectMapper lMapper = new ObjectMapper();
JsonNode lParsedValue;
  lParsedValue = lMapper.readTree(pJsonResponse);
catch (IOException lException)
  throw new RuntimeException ...