# Query json

**URL:** <https://community.glideapps.com/t/query-json/79846>\
**Category:** Ask for Help\
**Created:** [February 6, 2025, 6:16pm UTC](https://community.glideapps.com/t/query-json/79846 "2025-02-06T18:16:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![slscustom.ru](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/slscustom.ru/32/77336_2.png) [@slscustom.ru](https://community.glideapps.com/u/slscustom.ru)\
**Post date:** [February 6, 2025, 6:16pm UTC](https://community.glideapps.com/t/query-json/79846/1 "2025-02-06T18:16:14Z")

</div>

Hi community!  
I need help!  
I have this input JSON

```auto
{
  "discounts": {
    "PG1": 0.25,
    "PG2": 0.05
  },
  "prices": [
    {
      "goodsArticle": "TEST1",
      "priceGroup": "PG1",
      "price": 100
    }
  ]
}

```

I need this result

```auto
[
  {
    "goodsArticle": "TEST1",
    "priceGroup": "PG1",
    "price": 100,
    "discount": 0.25
  }
]

```

I tried several(tons) of tricks like

```auto
prices.{
  "goodsArticle": goodsArticle,
  "priceGroup": priceGroup,
  "price": price,
  "discount": discounts[priceGroup]
}

```

And

```auto
prices.{
  "goodsArticle": goodsArticle,
  "priceGroup": priceGroup,
  "price": price,
  "discount": $lookup(discounts, priceGroup)
}

```

But can’t force it to work. Every time Query JSON returned me

```auto
{
  "goodsArticle": "TEST1",
  "priceGroup": "PG1",
  "price": 100
}

```

i.e. without “discount”:  
Thanks!

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [February 6, 2025, 6:52pm UTC](https://community.glideapps.com/t/query-json/79846/2 "2025-02-06T18:52:25Z")

</div>

Hey, we got a winner.  
Tell AI that it’s a dirty liar often enough, it will eventually give you the correct answer. Try this.

```auto
prices.{
  "goodsArticle": goodsArticle,
  "priceGroup": priceGroup,
  "price": price,
  "discount": $lookup($$.discounts, priceGroup)
}

```

---

<div class="post-metadata">

**Author:** ![slscustom.ru](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/slscustom.ru/32/77336_2.png) [@slscustom.ru](https://community.glideapps.com/u/slscustom.ru)\
**Post date:** [February 6, 2025, 7:03pm UTC](https://community.glideapps.com/t/query-json/79846/3 "2025-02-06T19:03:44Z")

</div>

Thank you very much, Jeff!  
Million thanks! 🙏

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/system/32/53398_2.png) [@system](https://community.glideapps.com/u/system)\
**Post date:** [February 13, 2025, 7:03pm UTC](https://community.glideapps.com/t/query-json/79846/4 "2025-02-13T19:03:45Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
