1

My test.json file contains the 2 keys:

{
    "id": "123",
    "name": "John"
}

And I want to achieve something like this:

{
    "id": "John"
}

where as you can see I change the value of the key id with the value of the key name. I'm guessing I have to use jq (I'm using Ubuntu) but I'm quite noob and I don't really now how to do it.

Oscar
  • 13

1 Answers1

0

This should work:

jq '{id: .name}' input.json
A.H.
  • 450