Search code examples
javajsontoken

Extract a value from unstructured JSON response


My JSON response contains the token in a strange way as marked with the red line in the picture

enter image description here

How we can extract it without converting it to string and parsing the text? we want to extract it as is in this JSON format


Solution

  • Convert this JSON to a Map<String,Object>. Then you can easily do a getKey() to get the strange(UUId) key, and map.get(key) will give you the value for the key.