IBM / JSONata4Java

Open Source Java version of JSONata
Apache License 2.0
88 stars 36 forks source link

Incorrect lookup of parent node for % operator #279

Closed eschava closed 8 months ago

eschava commented 9 months ago

Please check the example below Data:

[{
   "parent": "a",
   "children": [{ "child": "c1"}, {"child": "c2"}]
}, {
   "parent": "b",
   "children": [{"child": "c1"}]
}]

Query

$.children.{'parent': %.parent, 'child': child}

produces

[ {
  "parent" : "b",
  "child" : "c1"
}, {
  "parent" : "a",
  "child" : "c2"
}, {
  "parent" : "b",
  "child" : "c1"
} ]

So for the first child of the "parent:a" node it finds another parent (perhaps because the child node is absolutely equal)