I would like to retrieve only the first name ocurrence.
[
{
"name": "xx",
"lastname": "yy",
"child": [
{
"name": "x2"
},
{
"name": "x3"
}
]
},
{
"name": "yy",
"lastname": "xz"}
]
with this regex: $..name the result is:
[
"xx",
"x2",
"x3",
"yy"
]
and with this $..name[0] is:
[
"x",
"x",
"x",
"y"
]
but I'm looking for this result:
[
"xx"
]
Note: it have to be in only one regex, I can't store result to after manipulate it
$..name[0]works for the Nebhale implementation. Based on the results you showed I suspect you are using Goessner's implementation. It might help to update the question to make this clear.