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.
Solved! Go to Solution.
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!