blgm / jfq

JSONata on the command line

Home Page:http://jsonata.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

about the syntax with $aFunction()

STEP-Team-Ray opened this issue · comments

commented

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

commented

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