Hi community!
I need help!
I have this input JSON
{
"discounts": {
"PG1": 0.25,
"PG2": 0.05
},
"prices": [
{
"goodsArticle": "TEST1",
"priceGroup": "PG1",
"price": 100
}
]
}
I need this result
[
{
"goodsArticle": "TEST1",
"priceGroup": "PG1",
"price": 100,
"discount": 0.25
}
]
I tried several(tons) of tricks like
prices.{
"goodsArticle": goodsArticle,
"priceGroup": priceGroup,
"price": price,
"discount": discounts[priceGroup]
}
And
prices.{
"goodsArticle": goodsArticle,
"priceGroup": priceGroup,
"price": price,
"discount": $lookup(discounts, priceGroup)
}
But can’t force it to work. Every time Query JSON returned me
{
"goodsArticle": "TEST1",
"priceGroup": "PG1",
"price": 100
}
i.e. without “discount”:
Thanks!