Show / Hide Table of Contents

Unary Minus Expression

unary-minus-expression = -expression

The - (unary minus) operator negates the value of the expression. It is only valid if the expression evaluates to a number.

Example

JSON Document:

[{"key": 0}, {"key": 42}, {"key": -1}, {"key": 41}, {"key": 43}, {"key": 42.0001}, {"key": 41.9999}, {"key": 100}, {"some": "value"}]

JSONPath:

$[?-@.key > -42]

Result:

[{"key": 0}, {"key": -1}, {"key": 41}, {"key": 41.9999}]
  • Improve this Doc
In This Article
Back to top Generated by DocFX