Alex Willmer
Alex Willmer

Reputation: 564

Does JMESPath have an identity function?

In the jq filtering language the . filter expression simply returns the input JSON unaltered (except for pretty printing). E.g.

$ echo '{"foo": true, "bar": 42}' | jq '.'
{
  "foo": true,
  "bar": 42
}

Does JMESPath have a similar expression (aka identity function)?

Upvotes: 5

Views: 264

Answers (1)

Alex Willmer
Alex Willmer

Reputation: 564

The current-node operator, aka @, performs this function in JMESPath, e.g.

$ echo '{"foo": true, "bar": 42}' | ~/.local/go/bin/jp @
{
  "bar": 42,
  "foo": true
}

Thanks to jdevillard on https://gitter.im/jmespath/chat for the answer.

Upvotes: 3

Related Questions