Filter expression with equals true

Setup

Selector: $[?(@.key==true)]

[
  {
    "some": "some value"
  },
  {
    "key": true
  },
  {
    "key": false
  },
  {
    "key": null
  },
  {
    "key": "value"
  },
  {
    "key": ""
  },
  {
    "key": 0
  },
  {
    "key": 1
  },
  {
    "key": -1
  },
  {
    "key": 42
  },
  {
    "key": {}
  },
  {
    "key": []
  }
]

Results

Consensus

[
  {
    "key": true
  }
]

Other responses

Bash (JSONPath.sh)

[
  true
]

C (json-glib)

Not supported

Unable to compile selector `$[?(@.key==true)]': Invalid array index definition “?(@.key==true)]”

Clojure (json-path) ¹

[
  {
    "some": "some value"
  },
  {
    "key": null
  }
]

Elixir (ExJsonPath)

Not supported

syntax error before: <<"true">>

Elixir (jaxon)

[]

Erlang (ejsonpath)

Not supported

syntax error before: ')'

Golang (github.com-bhmj-jsonslice) ¹ ³

[
  {
    "key": true
  },
  {
    "key": 1
  }
]

Golang (github.com-oliveagle-jsonpath) ¹

[]

JavaScript (Goessner) ²

[
  {
    "key": true
  },
  {
    "key": 1
  }
]

JavaScript (jsonpath)

[
  {
    "key": true
  },
  {
    "key": 1
  }
]

JavaScript (jsonpath-plus)

[
  {
    "key": true
  },
  {
    "key": 1
  }
]

Kotlin (com.nfeld.jsonpathkt) ¹

Not supported

Unexpected char, char=?, index=2

Objective-C (SMJJSONPath) ¹ ³

[
  {
    "key": true
  },
  {
    "key": 1
  }
]

Python (jsonpath) ²

Not found

jsonpath returned false, this might indicate an error

Python (jsonpath-ng)

Not supported

JsonPathLexerError('Error on line 1, col 2: Unexpected character: ? ')

Python (jsonpath-rw)

Not supported

JsonPathLexerError('Error on line 1, col 2: Unexpected character: ? ')

Python (jsonpath2)

Not supported

line 1:10 extraneous input '=' expecting {'@', '$', 'true', 'false', 'null', '{', '[', STRING, NUMBER}
ValueError("line 1:10 extraneous input '=' expecting {'@', '$', 'true', 'false', 'null', '{', '[', STRING, NUMBER}")

Raku (JSON-Path)

Not supported

Evaluation of embedded Raku code not allowed (construct with :allow-eval)

Rust (jsonpath)

Not supported

parsing error

Swift (Sextant)

[
  {
    "key": true
  },
  {
    "key": 1
  }
]

dotNET (JsonPathLib)

[
  {
    "key": true
  },
  {
    "key": 1
  }
]

dotNET (Manatee.Json)

[
  {
    "key": true
  },
  {
    "key": null
  },
  {
    "key": "value"
  },
  {
    "key": ""
  },
  {
    "key": 0
  },
  {
    "key": 1
  },
  {
    "key": -1
  },
  {
    "key": 42
  },
  {
    "key": {}
  },
  {
    "key": []
  }
]

Errors

PHP (Goessner) ²

ArgumentCountError

Perl (JSON-Path)

non-safe evaluation, died at main.pl line 11.

Footnotes