Dynatrace Business Events Extractions of Json Array

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:

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

How do I extract the value for Account or Name in the Business Analytics capture rules?  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

Hi,

Are you using DQL Array ?

Best regards

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

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

Path to capture account name:

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.

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.

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

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

Linked here from our good friend @KlausEnzenhofer - with a second question for ya: what about extracting an array into a bizevent field?

{
    "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 has a similar question: https://community.dynatrace.com/t5/Open-Q-A/How-to-Get-Specific-Properties-from-All-Elements-in-an-Array/m-p/257621#M34001

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.