add notes on jq
This commit is contained in:
parent
82a5a3d874
commit
2e69cb0d7c
1 changed files with 33 additions and 0 deletions
33
Linux/jq.md
Normal file
33
Linux/jq.md
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
---
|
||||||
|
tags: [new, json]
|
||||||
|
---
|
||||||
|
|
||||||
|
# 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))`
|
Loading…
Add table
Reference in a new issue