I have an object similar to the following:
{
"list": [
{
"price": "50",
"items": {
"XYZ": {
"price": "6",
"id": "1212121"
},
"details": {},
"id": "1647308"
}
},
{
"price": "20",
"items": {
"XYZ": {
"price": "10",
"id": "1212121"
},
"details": {},
"id": "1647308"
}
}
]
}
public class List {
private string price;
private List<Item> items;
private string id;
}
public class Item {
private Map<String, BonusItem> bonusItem;
}
public BonusItem
{
private string price;
}
From the above list I need to fetch the array object inside "items"-> "XYZ", and the output should be something like below. I am trying using a Java stream.
[
{
"price":"10",
"id":"1212121"
},
{
"price":"6",
"id":"1212121"
}
]
I tried couple of options and getting compile error with lambda and I am new to Java and Map objects.