Recursive Tree Traversal #148
Replies: 4 comments 7 replies
-
+1 |
Beta Was this translation helpful? Give feedback.
-
I have drafted a very ugly working prototype for a new Recursive Traversal
AbstractMotivationSpecificationA new descendant = ".." identifier
descendant-expression = ( expression ) 1*( descendant )
expression =/ descendant-expression A ExamplesGiven the following JSON input: {
"name": "first",
"top": { "name": "second" },
"nested": {
"name": [
1, "string", false,
{ "name": "third" }
]
}
} The following expressions are possible:
Compliance TestsThis JEP standardizes a syntax that was formely not valid. For this reason, one of the syntax.json compliance tests must be changed or removed altogether: {
"expression": ".foo",
"error": "syntax"
},
{
"expression": "foo..bar",
- "error": "syntax"
+ "result": null
}, A new file |
Beta Was this translation helpful? Give feedback.
-
@springcomp Sorry if I'm missing anything here but I wasn't able to figure that out quickly: What is the current status on that resp. what is missing to get this implemented? I would really like to be able to use that feature. (We would need that for a JSON with a recursive structure of unknown (but not unlimited) depth.) |
Beta Was this translation helpful? Give feedback.
-
Recursive Traversal
AbstractMotivationSpecificationA new recursive-traversal = ".."
descendant-expression = recursive-traversal expression
descendant-expression =/ expression descendant-expression
expression =/ descendant-expression A When evaluated on a scalar, a When evaluated on an array, a When evaluated on an object, a At each step, the results of the evaluations are collected, while ExamplesGiven the following JSON input: {
"name": "first",
"top": { "name": "second" },
"nested": {
"name": [
1, "string", false,
{ "name": "third" }
]
}
} The following expressions are possible:
EvaluationTo better understand how a
First, the
Finally, the results are collected into the resulting array:
Compliance TestsThis JEP standardizes a syntax that was formely not valid. For this reason, one of the syntax.json compliance tests must be changed or removed altogether: {
"expression": ".foo",
"error": "syntax"
},
{
"expression": "foo..bar",
- "error": "syntax"
+ "result": null
}, A new file |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Please, consider adding features to do arbitrarily deep searches, much like the xpath query
//my-element/my-other-element
.Beta Was this translation helpful? Give feedback.
All reactions