# 📌 TIP#1: Extracting values from a JSON\_ARRAY using DQL

**URL:** <https://community.dynatrace.com/t/tip-1-extracting-values-from-a-json-array-using-dql/52429>\
**Category:** Dynatrace Tips\
**Tags:** log-analytics, dql, business-analytics, business-events, notebooks, tips-and-tricks, logs\
**Created:** [July 9, 2025, 4:30pm UTC](https://community.dynatrace.com/t/tip-1-extracting-values-from-a-json-array-using-dql/52429 "2025-07-09T16:30:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tracegazer](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/tracegazer/32/32785_2.png) [@tracegazer](https://community.dynatrace.com/u/tracegazer)\
**Post date:** [July 9, 2025, 4:30pm UTC](https://community.dynatrace.com/t/tip-1-extracting-values-from-a-json-array-using-dql/52429/1 "2025-07-09T16:30:57Z")

</div>

When analyzing logs or business events that include structured payloads, it’s common to receive data in the form of a JSON\_ARRAY. If your field contains this format (for example, under rs.body\_result), you can extract specific values from each object in the array.

Here’s a real-world example, where the array contains market data objects with fields like symbol, currency and broadcast\_time:

```auto
[
  { "symbol": "BNA6C", "currency": "EXT", "closing_price": 103, "broadcast_time": "91844" },
  { "symbol": "BNA6X", "currency": "ARS", "closing_price": 107000, "broadcast_time": "91847" },
  { "symbol": "BN2M6", "currency": "ARS", "closing_price": 0.01, "broadcast_time": "91847" },
  { "symbol": "BU4J6", "currency": "ARS", "closing_price": 101.1, "broadcast_time": "91843" }
]

```

To extract all broadcast\_time values and get the array size, use the following **DQL** :

```auto
| parse rs.body_result, """JSON_ARRAY:parsed_json_elements"""
| fieldsAdd array(parsed_json_elements[][broadcast_time]), alias: array.broadcast_time
| fieldsAdd arraySize(parsed_json_elements), alias: array.broadcast_time_count

```

#### 🎯 Use Case: Finding the latest broadcast time

If your goal is to identify the most recent broadcast (i.e., the highest broadcast\_time), simply add:

```auto
| fieldsAdd arrayMax(array.broadcast_time), alias: array.broadcast_time_max

```

This gives you the highest value inside the broadcast\_time array.

#### 🧪 Real Example Output (Notebook)

After running the full query in a Dynatrace Notebook, the result looks like this:

- **array.broadcast\_time:** [[“91840”], [“91834”], [“91838”], [“91821”], [“91842”], [“91841”], [“132548”], [“151414”], [“91822”], [“91843”], [“91841”], [“91842”], [“165520”], [“91843”], [“91842”], [“91820”], [“91824”], [“91820”], [“91821”], [“91820”], [“91843”], [“91840”], [“91841”], [“91829”], [“91845”], [“91815”], [“91845”], [“91829”], [“163735”]]
- **array.broadcast\_time\_count:** 29
- **array.broadcast\_time\_max:** 165520

#### 📘 Notes:

- This method works on any JSON\_ARRAY-compatible field in logs or business events.
- You can replace broadcast\_time with any other field (like symbol, currency, etc.).
- Useful in financial feeds, external API logs, or payload inspection scenarios where the structure is consistent but the array length varies.

Hope this helps streamline your JSON parsing in Dynatrace!

---

<div class="post-metadata">

**Author:** ![AntonPineiro](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/antonpineiro/32/49_2.png) [@AntonPineiro](https://community.dynatrace.com/u/AntonPineiro)\
**Post date:** [July 10, 2025, 9:15am UTC](https://community.dynatrace.com/t/tip-1-extracting-values-from-a-json-array-using-dql/52429/2 "2025-07-10T09:15:57Z")

</div>

Nice! Thank you! 🤑

---

<div class="post-metadata">

**Author:** ![GerardJ](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/gerardj/32/154_2.png) [@GerardJ](https://community.dynatrace.com/u/GerardJ)\
**Post date:** [July 10, 2025, 1:55pm UTC](https://community.dynatrace.com/t/tip-1-extracting-values-from-a-json-array-using-dql/52429/3 "2025-07-10T13:55:16Z")

</div>

Thanks for sharing&nbsp;🙏
