Tuesday, July 26, 2022

[SOLVED] How to replace multine values to empty string in linux?

Issue

enter image <a name='more'></a>description here

I wanted to change this value

{
"data":"correctValue",
  "attributes": [
    {
      "otherValue": "incorrectValue"
    }
  ]
}

to

{
"data":"correctValue"
}

Solution

Or, if instead of deleting the attributes you want to keep .data, you can do:

jq '{data: .data}' input-file


Answered By - William Pursell
Answer Checked By - Mildred Charles (WPSolving Admin)