blgm/jfq

about the syntax with $aFunction()

STEP-Team-Ray opened this issue · 1 comments

Hi.

jfq is good and it does the job for most of my queries; yet I meet a difficulty with syntax like this (in Terminal, bash)

jfq "$contains('the contracts', 'contract')"

that returns

Failed to compile JSONata expression: Expected ")", got ","

The syntax works fine on try.jsonata.org and returns true
What should I change so it works with jfq as well?

Ray

So... I've figured out that it has to do with $ and the regular bash variable expansion when the $variable is enclosed in double quotes, i.e. "$variable" ... thus, the basic fix is to use simple quotes, like this:

echo '{}' | jfq '$contains("the contracts", "contract")'
true