cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Dynatrace Business Events Extractions of Json Array

keekos
Frequent Guest

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#repor...

4 REPLIES 4

AntonPineiro
DynaMight Guru
DynaMight Guru

Hi,

Are you using DQL Array ?

Best regards

❤️ Emacs ❤️ Vim ❤️ Bash ❤️ Perl

isidre
Dynatrace Enthusiast
Dynatrace Enthusiast

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.

keekos
Frequent Guest

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 ") 

isidre
Dynatrace Enthusiast
Dynatrace Enthusiast

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

Featured Posts