jq 错误语法错误,意外的“=”,期望“}”(Unix shell 引用问题?)在 <top-level>

spi*_*man 5 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
Run Code Online (Sandbox Code Playgroud)

Jac*_*all 5

对象构造jq使用类似于 JavaScript 对象表示法 (JSON) 的语法。

{"ParameterValue" = "jess-project"}在 JSON 中无效。你的意思{"ParameterValue": "jess-project"}