eolas/neuron/7aecb0c4-f9f9-4579-9564-8a4cb5e9c958/jq.md
2025-03-14 17:01:58 +00: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))