Understanding recursion in JSONata
(
$person := function($node) { $node.{"n": Name, "p":$person(Parent.Person)}};
{
"Person": Person ~> $person($)
}
)
Explanation
1. Function Definition:
2. Applying the Function
Enhancing the Example
JSON Input Example
Expanded Function and Query
Explanation
Example Output
Additional Example & Use Cases
Example with Siblings
JSON Input
Expanded Function and Query to Handle Siblings
Conclusion
Was this helpful?
