# Dynatrace Business Events Extractions of Json Array

**URL:** <https://community.dynatrace.com/t/dynatrace-business-events-extractions-of-json-array/38977>\
**Category:** Open Q&A\
**Tags:** dynatrace-managed, oneagent\
**Created:** [March 23, 2023, 2:17pm UTC](https://community.dynatrace.com/t/dynatrace-business-events-extractions-of-json-array/38977 "2023-03-23T14:17:02Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![keekos](https://avatars.discourse-cdn.com/v4/letter/k/ebca7d/32.png) [@keekos](https://community.dynatrace.com/u/keekos)\
**Post date:** [March 23, 2023, 2:17pm UTC](https://community.dynatrace.com/t/dynatrace-business-events-extractions-of-json-array/38977/1 "2023-03-23T14:17:02Z")

</div>

I’m having trouble extracting array attributes when there isn’t a top level name for the array.

For example, given the following json request body payload:

```java
[{"Account":"f2fafaf3a","Name":"John Doe","MediumID":"a9fjah"}]

```

How do I extract the value for Account or Name in the Business Analytics capture rules?&nbsp; The documentation here doesn’t seem to cover this use case.

[https://www.dynatrace.com/support/help/platform-modules/business-analytics/ba-events-capturing#report-business-event-oneagent](https://www.dynatrace.com/support/help/platform-modules/business-analytics/ba-events-capturing#report-business-event-oneagent)

---

<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:** [March 24, 2023, 8:24am UTC](https://community.dynatrace.com/t/dynatrace-business-events-extractions-of-json-array/38977/2 "2023-03-24T08:24:57Z")

</div>

Hi,

Are you using [DQL Array](https://www.dynatrace.com/support/help/shortlink/dql-data-types#array)&nbsp;?

Best regards

---

<div class="post-metadata">

**Author:** ![isidre](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/isidre/32/30374_2.png) [@isidre](https://community.dynatrace.com/u/isidre)\
**Post date:** [April 4, 2023, 7:27am UTC](https://community.dynatrace.com/t/dynatrace-business-events-extractions-of-json-array/38977/3 "2023-04-04T07:27:54Z")

</div>

An example of capturing a JSON with nested array (with a JSON element inside of it in position 0):

```markup
{
    "id2": "json_with_array_json_nested",
    "accountData":
    [
        {
            "Account": "f2fafaf3a",
            "Name": "John Doe",
            "MediumID": "a9fjah"
        }
    ]
}

```

Path to capture account name:

```markup
accountData.0.Account

```

This works to get the first position of the array “0” and the value inside the nested JSON. This works on single value arrays.

---

<div class="post-metadata">

**Author:** ![keekos](https://avatars.discourse-cdn.com/v4/letter/k/ebca7d/32.png) [@keekos](https://community.dynatrace.com/u/keekos)\
**Post date:** [April 4, 2023, 8:05pm UTC](https://community.dynatrace.com/t/dynatrace-business-events-extractions-of-json-array/38977/4 "2023-04-04T20:05:22Z")

</div>

Thanks, that unfortunately doesn’t cover the use case when your data sample omits accountData key for the array.

I ended up using DQL parse and was able to retrieve the correct value.

```markup
PARSE(requestbody, "DATA 'Account'LD SPACE?':' SPACE? DQS:Account ")

```

---

<div class="post-metadata">

**Author:** ![isidre](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/isidre/32/30374_2.png) [@isidre](https://community.dynatrace.com/u/isidre)\
**Post date:** [April 5, 2023, 4:10pm UTC](https://community.dynatrace.com/t/dynatrace-business-events-extractions-of-json-array/38977/5 "2023-04-05T16:10:58Z")

</div>

Ok, so the request body is an array containing a single JSON. Understood.  
A processing rule works fine then. great!

---

<div class="post-metadata">

**Author:** ![mtomlinson\_not](https://avatars.discourse-cdn.com/v4/letter/m/ee7513/32.png) [@mtomlinson\_not](https://community.dynatrace.com/u/mtomlinson_not)\
**Post date:** [October 2, 2024, 11:26am UTC](https://community.dynatrace.com/t/dynatrace-business-events-extractions-of-json-array/38977/6 "2024-10-02T11:26:25Z")

</div>

Linked here from our good friend&nbsp;[@KlausEnzenhofer](https://community.dynatrace.com/user/316) - with a second question for ya: what about extracting an array into a bizevent field?

```markup
{
    "id2": "json_with_array_json_nested",
    "accountData":
    [
        {
            "Account": "f2fafaf3a",
            "Name": "John Doe",
            "MediumID": "a9fjah"
        },
        {
            "Account": "gkahfkgjnv",
            "Name": "Andreas Grabner",
            "MediumID": "03u6n9"
        },
        {
            "Account": "5j2nngov8bn",
            "Name": "Brian Wilson",
            "MediumID": "03u5nvov94n"
        }
    ]
}

```

And I wanted to grab just the Name and MediumID fields.

Using this matcher: $.accountData.[Name,MediumID] would return an array and not a string.

Would we need to just JSONParse() that field then similar to the DPL above?

[@victoria](https://community.dynatrace.com/user/56003)&nbsp;has a similar question:&nbsp;[https://community.dynatrace.com/t5/Open-Q-A/How-to-Get-Specific-Properties-from-All-Elements-in-an-Array/m-p/257621#M34001](https://community.dynatrace.com/post/257621#M34001)

---

<div class="post-metadata">

**Author:** ![victoria\_dt](https://avatars.discourse-cdn.com/v4/letter/v/f19dbf/32.png) [@victoria\_dt](https://community.dynatrace.com/u/victoria_dt)\
**Post date:** [October 2, 2024, 12:01pm UTC](https://community.dynatrace.com/t/dynatrace-business-events-extractions-of-json-array/38977/7 "2024-10-02T12:01:25Z")

</div>

Yeah my only specific concern is that I do not want to capture the entire complex object into the biz event since some of it contains sensitive information. So I do not even want it to get to the point where I can parse it with DQL.
