-1
 ResponseEntity<String> respEntity = null;
        try {
            respEntity = getConfiguredRestTemplate().exchange(uri.toString()
                    , HttpMethod.GET
                    , entity
                    , new ParameterizedTypeReference<String>() {
                    });
            log.debug("URL to retrieve a document : {}", respEntity.getBody());
}

The respEntity.getBody() returns {"url":"https://aps-fst"}

I want to send only the value - https://aps-fst as parameter to a function to download the content in the URL. How to extract only the URL value and pass it as parameter of type URL / String ?

Dev
  • 21
  • 1
  • 6
  • 1
    Does this answer your question? [How to parse JSON in Java](https://stackoverflow.com/questions/2591098/how-to-parse-json-in-java). It is called JSON parsing. Check the link i shared for the information. – Rajen Raiyarela Aug 28 '20 at 12:45

2 Answers2

0

You can use ObjectMapper from jackson and have the response body transformed into a map from which you can take the url value. You can find an example here.

Vladimir Stanciu
  • 1,468
  • 1
  • 7
  • 24
-1
  String jsonString = respEntity.getBody();
   JSONObject obj = new JSONObject(jsonString);
   String s3urlvalue = obj.getString("url");
   log.debug("S3 URL  to retrieve a document : {} ", s3urlvalue);

I am able to get value with above code

Dev
  • 21
  • 1
  • 6