maptool icon indicating copy to clipboard operation
maptool copied to clipboard

[Bug]: json.path's filter expressions cannot compare arrays

Open Pmofmalasia opened this issue 2 years ago • 0 comments

Describe the Bug

According to the documentation for the json.path functions, the filter operators for the path are supposed to be able to compare arrays - see the in, nin, subsetof, anyof, etc. operators linked. However, rather than correctly filter based on the operators, it only returns an empty array. This is not exclusive to the operators meant for arrays - using == to compare one array to another similarly returns a blank array.

To Reproduce

Run the following code:

`[H: data = json.append("", json.set("{}","key",1,"array",json.append("",2,3)), json.set("{}","key",2,"array",json.append("",1,2,3)) )]

[R: json.path.read(data,"[][?(@.key in @.array)]")] [R: json.path.read(data,"[][?(@.key == 1)]")] [R: json.path.read(data,"[*][?(@.array == [2,3])]")]`

Only the second output will return anything, while the first and third return an empty array.

Expected Behaviour

Proper comparisons of arrays in the path.

Screenshots

No response

MapTool Info

1.11.4

Desktop

Windows 10

Additional Context

No response

Pmofmalasia avatar Feb 03 '22 22:02 Pmofmalasia