The URI myresourceUrl when hit in browser shows the json content in browser.
Requirement: Need to use the get method of httpbuilder-ng to call GET of URI and response should have the content as json.
This json file will be necessary as input for another task. How to achieve this. Do we need any parser to get the returned response as json using http-builder-ng.
Expected response format: {"name":"Abc","info":{"age":45,"height":"5.5"}}
Tried the below get request using:
// setting the request URI
HttpBuilder http = HttpBuilder.configure(config -> {
config.getRequest().setUri(myresourceUrl);
});
String response = http.get(LazyMap.class, cfg -> {
cfg.getRequest().getUri().setPath(myPath);
}).toString();
Actual format we are getting: {name:Abc,info:{age:45,height:5.5}}
How to get the response indicated above in expected response format.