Forum Discussion

majeedsaid's avatar
majeedsaid
Occasional Visitor
2 years ago

jsonpath of elements of dynamic arrays in an array

Hi,
I have a a json with an array that includes dynamic number of arrays.
with jsonpath in java i would like to extract the n-th element of each inner array.
when I do it in online jsonpath pages it works, but with java its not working correctly.
my json looks like :
{
“data”: [
[
“1657618349.663”,
“OAUTHDB”,
“N”,
“N”,
“”,
“ACCOUNTADMIN”,
“”,
“”,
“1”
],
[
“1657276657.647”,
“SNOWFLAKE”,
“N”,
“N”,
“SNOWFLAKE.ACCOUNT_USAGE”,
“”,
“”,
“”,
“1”
],
[
“1657276660.567”,
“SNOWFLAKE_SAMPLE_DATA”,
“N”,
“N”,
“SFSALESSHARED.SFC_SAMPLES_VA3.SAMPLE_DATA”,
“ACCOUNTADMIN”,
“Provided by Snowflake during account provisioning”,
“”,
“1”
]
]
}

i want to evaluate this path : “$…data[*].[1]” but its not wokring and returning all elements of second array. seems to be the asteriks is not wokring correctly. how can i do this or how should my path looks like?
the number on inner arrays is dynamic.

Best Regards,
Majeed

No RepliesBe the first to reply