eolas/neuron/3962ef80-32e3-49b8-8e16-d14a26e9787a/jq.md
2024-10-22 16:47:58 +01:00

515 B

tags
json
shell

jq

Remove property

Remove property from a JSON array of objects:

{
  "member_inputs": [
    {
      "name": "Thomas",
      "input_type": "select"
    },
    {
      "name": "Martha",
      "input_type": "text"
    }
  ]
}
jq '.member_details |= map(del(.input_type))' memberDetails.json

Add '-i' to modify the source file directly (in-place)

Multiple properties can be deleted simply by chaining, e.g.(del(.input_type, .another_property))