09 Jul 2025
05:30 PM
- last edited on
31 Jul 2025
12:42 PM
by
Michal_Gebacki
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:
[ { "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:
| 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
If your goal is to identify the most recent broadcast (i.e., the highest broadcast_time), simply add:
| fieldsAdd arrayMax(array.broadcast_time), alias: array.broadcast_time_max
This gives you the highest value inside the broadcast_time array.
After running the full query in a Dynatrace Notebook, the result looks like this:
Hope this helps streamline your JSON parsing in Dynatrace!
10 Jul 2025 10:15 AM
Nice! Thank you!