# Help with Querying JSON in Stripe Webhook for Invoice Field

**URL:** <https://community.glideapps.com/t/help-with-querying-json-in-stripe-webhook-for-invoice-field/79383>\
**Category:** Ask for Help\
**Created:** [January 21, 2025, 3:14pm UTC](https://community.glideapps.com/t/help-with-querying-json-in-stripe-webhook-for-invoice-field/79383 "2025-01-21T15:14:29Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Simon\_Hill](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/simon_hill/32/94730_2.png) [@Simon\_Hill](https://community.glideapps.com/u/Simon_Hill)\
**Post date:** [January 21, 2025, 3:14pm UTC](https://community.glideapps.com/t/help-with-querying-json-in-stripe-webhook-for-invoice-field/79383/1 "2025-01-21T15:14:29Z")

</div>

Hi everyone,

I’ve set up a Stripe webhook that successfully triggers when an invoice is paid. The webhook sends the JSON payload shown in the attached screenshot, and I need to extract the field named `invoice` (highlighted in yellow in the image). This `invoice` field is crucial as it represents a userID column in my Glide app, used to identify and track the invoice.

The issue:

- When I query the JSON body using the Glide Query JSON step, I can retrieve the very first `id` field, but I can’t figure out the correct path to extract the `invoice` field.
- I’ve tried various paths like `data.object.invoice`, but it doesn’t seem to return the expected result.

Could someone guide me on the correct query path or provide insights on what might be going wrong? I am spending a dollar a go to try different path options to no avail… a smart tip would be great!

Thanks in advance for your help!

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/6/e/6ed141b3bc987ba47ecfb90f67a0f98ab6336eb6.png)

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/0/0/006405e27987cecf4a31b5262bd8197bcc4e7009.png)

---

<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:** [January 21, 2025, 3:35pm UTC](https://community.glideapps.com/t/help-with-querying-json-in-stripe-webhook-for-invoice-field/79383/2 "2025-01-21T15:35:55Z")

</div>

Try something like data.object.lines.data[0].invoice

I think the problem is that you aren’t specifying the array item you want for the second data node.

---

<div class="post-metadata">

**Author:** ![Simon\_Hill](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/simon_hill/32/94730_2.png) [@Simon\_Hill](https://community.glideapps.com/u/Simon_Hill)\
**Post date:** [January 21, 2025, 3:44pm UTC](https://community.glideapps.com/t/help-with-querying-json-in-stripe-webhook-for-invoice-field/79383/3 "2025-01-21T15:44:47Z")

</div>

Thanks I will try that.

---

<div class="post-metadata">

**Author:** ![Simon\_Hill](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/simon_hill/32/94730_2.png) [@Simon\_Hill](https://community.glideapps.com/u/Simon_Hill)\
**Post date:** [January 21, 2025, 4:45pm UTC](https://community.glideapps.com/t/help-with-querying-json-in-stripe-webhook-for-invoice-field/79383/4 "2025-01-21T16:45:07Z")

</div>

Good to know that unlike many of us, Jeff remains smarter than ChatGPT. Thanks so much! It worked… 🙂

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/c/d/cdbc399c802a4521a7237cf4a73d6858922dce88.png)

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [January 22, 2025, 12:01am UTC](https://community.glideapps.com/t/help-with-querying-json-in-stripe-webhook-for-invoice-field/79383/5 "2025-01-22T00:01:54Z")

</div>

Next time you get stuck with something like this, you can paste the JSON output to ChatGPT/Claude and ask it to write a query using JSONata. That’s what Glide uses under the hood for Query JSON.

---

<div class="post-metadata">

**Author:** ![Simon\_Hill](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/simon_hill/32/94730_2.png) [@Simon\_Hill](https://community.glideapps.com/u/Simon_Hill)\
**Post date:** [January 22, 2025, 1:11am UTC](https://community.glideapps.com/t/help-with-querying-json-in-stripe-webhook-for-invoice-field/79383/6 "2025-01-22T01:11:11Z")

</div>

I did many times but GPT could not solve it…

(Do you know if it’s possible to copy a payload from a webhook log into clipboard? One challenge was doing this versus sharing a screenshot with GPT. I couldn’t highlight the text in Glide payload log to do this nor could I find a place in Stripe that would provide it. Since the payload ran over 1 screen this made it troublesome).

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [January 22, 2025, 2:30am UTC](https://community.glideapps.com/t/help-with-querying-json-in-stripe-webhook-for-invoice-field/79383/7 "2025-01-22T02:30:31Z")

</div>

> [@ThinhDinh](#):
>
> Next time you get stuck with something like this, you can paste the JSON output to ChatGPT/Claude and ask it to write a query using JSONata. That’s what Glide uses under the hood for Query JSON.

My experience with ChatGPT is that it is terrible with JSONata. It has no problems with simple queries (those that I wouldn’t need it for), but fails miserably with any more complex queries. On two separate occasions I’ve given it a chance, and both times I’ve given up in exasperation after about an hour of going around in circles. I’ve not tried Claude.

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [January 22, 2025, 2:35am UTC](https://community.glideapps.com/t/help-with-querying-json-in-stripe-webhook-for-invoice-field/79383/8 "2025-01-22T02:35:07Z")

</div>

In the limited times I try it, it works, but that was a long time ago and it’s likely I didn’t have a complex query.

I have used Claude ever since and it works really well with coding stuff. Recently we have the open source model DeepSeek, which has a cool thinking mode and it generates fine as well (and is free).

---

<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:** [January 29, 2025, 2:35am UTC](https://community.glideapps.com/t/help-with-querying-json-in-stripe-webhook-for-invoice-field/79383/9 "2025-01-29T02:35:36Z")

</div>

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