Issue
I have a simple question, say I have the following json
{
"ALPHA":[
....
],
"BETA":[
....
],
"GAMMA":[
.....
]
}
how do I access the subroot elements, I mean just the names: "ALPHA","BETA","GAMMA"
using jsonPath? Be aware that I mean their names not their array!!!
I tried jsonPath("$[*]", ...)
but it doesn't work, any sugesstions?
Solution
Thanks a lot @Raymond Choi, it should also work.
But based on your answer, that I should use the function keys()
, I search a lit bit more and I found that jsonPath
indeed has his own function.
So the solution to my question is simple:
jsonPath("$.keys())
Answered By - Ilias Mertzanidis
Answer Checked By - Dawn Plyler (JavaFixing Volunteer)