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 :
“Provided by Snowflake during account provisioning”,
i want to evaluate this path : “$…data[*].” 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.
Welcome to the KNIME community!
You were very close, but
$['data'][*] is the right syntax here (without period). Moreover, you need to make sure that you have the List checkbox marked. That way it will capture all instances of , regardless how many inner arrays you have.
When you apply it, you’ll see that the JSON path will highlight all nominated elements in blue.
If you then ungroup the list, you’ll get all the records
Hope this helps!
Thank u for ur response.
my question is how can this be done in java?
can u advise any third-party jar that can achieve this for me?
If KNIME can do this for you, why would you want to do it manually? That’s more a programming question rather than a KNIME question. There are more suitable other forums for that.
Maybe the source code contains some hints as well.
Or how KNIME uses it:
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.