mirror of
https://gitea.com/mcereda/oam.git
synced 2026-02-09 05:44:23 +00:00
Added examples to JQ's notes
This commit is contained in:
@@ -3,6 +3,12 @@
|
||||
## TL;DR
|
||||
|
||||
```sh
|
||||
# Only list keys.
|
||||
jq 'keys' file.json
|
||||
|
||||
# Sort all the keys.
|
||||
jq --sort-keys '.' input.json > output.json
|
||||
|
||||
# Add a key.
|
||||
jq --arg REGION ${AWS_REGION} '.spec.template.spec.containers[]?.env? += [{name: "AWS_REGION", value: $REGION}]' /tmp/service.kube.json
|
||||
|
||||
@@ -27,9 +33,6 @@ jq '.extensionsGallery + {
|
||||
itemUrl: "https://marketplace.visualstudio.com/items"
|
||||
}' /usr/lib/code/product.json
|
||||
|
||||
# Sort all the keys.
|
||||
jq --sort-keys '.' input.json > output.json
|
||||
|
||||
# Put specific keys on top.
|
||||
jq '.objects = [(.objects[] as $in | {type,name,id} + $in)]' prod/dataPipeline_deviceLocationConversion_prod.json
|
||||
|
||||
|
||||
Reference in New Issue
Block a user