0

I have below JSON file and would like to update the values of these keys --resType and --LogLevel using jq.

{
    "--resType": "FILE",
    "--LogLevel": "INFO"
}

To do that, I am using below command.

./jq .--resType=Test config.json>test.json

But, I see an error that says

"jq: error: Test/0 is not defined at , line 1:".

"jq: 2 compile errors"

Community
  • 1
  • 1
Ras
  • 543
  • 1
  • 9
  • 25
  • 1
    You do a special quote around the keys to let it to be understood as a valid key name `jq '."--resType"' config.json` or another way with the square braces `[..]` as `jq '.["--resType"]' config.json` – Inian Oct 01 '19 at 06:53
  • ./jq '."--resType"'=\"Test\" config.json >test.json worked for me. Thank you. – Ras Oct 01 '19 at 14:17

0 Answers0