jq错误语法错误,意外'=',期待'}'(Unix shell引用问题?)在<顶级>

时间:2017-11-17 01:49:37

标签: syntax-error jq

cat test.json | jq 'map(if ParameterKey == "Project"           then . + {"ParameterValue" = "jess-project"}             else .             end           )'

jq: error: syntax error, unexpected '=', expecting '}' (Unix shell quoting issues?) at <top-level>, line 1:
map(if ParameterKey == "Project"           then . + {"ParameterValue" = "jess-project"}             else .             end           )                                                                      
jq: 1 compile error

1 个答案:

答案 0 :(得分:1)

jq中的对象构造使用类似于JavaScript Object Notation(JSON)的语法。

{"ParameterValue" = "jess-project"}在JSON中无效。您的意思是{"ParameterValue": "jess-project"}吗?