0

I'm curious , if exist software like jq that is able to edit json file, but only required parts. I do not want that it touches identaions or consequences of the elements in documents. For example origin file contains:

{"foo":"bar","bug":1}

cat | origfile .jq.bug=2 will return

{
  "foo": "bar",
  "bug": 2
}

But I desire

{"foo":"bar","bug":2}

It should be json parser,not sed or similar tools. Format can be any ,but only target value should be changed.

  • No need for another json parster. You can use jq -c for compact and add -r for raw output ... then you get the desired result. – pLumo Jan 28 at 7:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.