For XML files in Ballerina, if we want to access a node with a given name nested anywhere within the tree, we can access it using the following way.
// x/**/<name> - for every element e in x, retrieves every element named name in
// the descendants of e.
xml f = x/**/<name>;
io:println("f",f,"nn");
Is there a similar way to access a JSON object key with a given name that can be nested anywhere inside the main JSON object?
2
Answers
If we take the above JSON example, we can solve the specific scenario with optional field access and a query expression.
Please refer these as well:
In summary, the OP refers to Convenient XML navigation.
No. At least not yet.