eolas/neuron/f3ec2d6c-97a4-4a7a-9dfe-64824a6e94ae/jq.md
2024-11-25 07:19:28 +00:00

35 lines
515 B
Markdown

---
tags:
- json
- shell
---
# jq
## Remove property
Remove property from a JSON array of objects:
```json
{
"member_inputs": [
{
"name": "Thomas",
"input_type": "select"
},
{
"name": "Martha",
"input_type": "text"
}
]
}
```
```sh
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))`