I have Map<String, Object> currencyRate that contains
"license": "https:/etc",
"timestamp": 1654,
"base": "USD",
"rates": {
"AED": 3.6,
"AFN": 88.9,
"ALL": 112,
etc
}
And e.g. I want to get "AED" value which is 3.6.
I've tried this:
Map<String, Object> filtered = currencyRate.entrySet()
.stream()
.filter(map->map.getValue().toString().contains("AED"))
.collect(Collectors.toMap(map -> map.getKey(), map -> map.getValue()));
But it returned this:
"rates": {
"AED": 3.6,
"AFN": 88.9,
"ALL": 112,
etc
}
So "rates" is key, and it has values which also has keys and values.
How can I get keys and values in "rates"?