jdevillard / JmesPath.Net

A fully compliant implementation of JMESPATH for .NetCore

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Flatten operator should not produce an array with null elements

lodejard opened this issue · comments

Scenario

Using flatten operator [] or wildcard expression [*] on arrays, the result shouldn't contain elements which are null.

Starting with the the following json:

{"data":[null,["a",null,"b"],["c",["d",null,"e"],"f"]]}

Expected

data[] produces:

["a","b","c",["d",null,"e"],"f"]

data[*] produces:

[["a",null,"b"],["c",["d",null,"e"],"f"]]

map(&@,data) produces:

[null,["a",null,"b"],["c",["d",null,"e"],"f"]]

Actual

data[] produces:

[null,"a",null,"b","c",["d",null,"e"],"f"]

data[*] produces:

[null,["a",null,"b"],["c",["d",null,"e"],"f"]]

map(&@,data) is correct

Yes, you are right.
Thanks for pointing this out.