Skip to content

Instantly share code, notes, and snippets.

@dsimonow
Created July 4, 2020 15:54
Show Gist options
  • Save dsimonow/41bd718650c1f956380cc8cd912647eb to your computer and use it in GitHub Desktop.
Save dsimonow/41bd718650c1f956380cc8cd912647eb to your computer and use it in GitHub Desktop.
JsonNode notCheckedResponse = aquireStockGlobalQuoteString(stockSymbol);
String searchedStockName = stockName;
String response = "";
ObjectMapper mapper = new ObjectMapper();
if(notCheckedResponse.has("Error Message")){
try {
response = mapper.writeValueAsString(notCheckedResponse);
} catch (JsonProcessingException e) {
e.printStackTrace();
}
} else if (notCheckedResponse.has("Note")) {
try {
response = mapper.writeValueAsString(notCheckedResponse);
} catch (JsonProcessingException e) {
e.printStackTrace();
}
} else {
AVGlobalQuoteResponseDto globalQuoteDTO = null;
try {
globalQuoteDTO = mapper.treeToValue(notCheckedResponse, AVGlobalQuoteResponseDto.class);
} catch (JsonProcessingException e) {
log.info(e.getMessage());
e.printStackTrace();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment