diff --git a/pages/common/jq.md b/pages/common/jq.md index db021222ba964..b87c727aa7384 100644 --- a/pages/common/jq.md +++ b/pages/common/jq.md @@ -2,6 +2,7 @@ > A JSON processor that uses a domain-specific language (DSL). > More information: . +> See also: `trdsql` - Execute a specific expression (print a colored and formatted JSON output): @@ -15,9 +16,9 @@ `{{cat path/to/file.json}} | jq {{--arg "name1" "value1" --arg "name2" "value2" ...}} '{{. + $ARGS.named}}'` -- Print selected specific keys as JSON object: +- Create new JSON object via an old JSON object: -`{{cat path/to/file.json}} | jq '{{{key1,key2, ...}}}'` +`{{cat path/to/file.json}} | jq '{{{newKey1: .key1, newKey2: .key2.nestedKey, ...}}}'` - Print specific array items: @@ -27,7 +28,7 @@ `{{cat path/to/file.json}} | jq '.[]'` -- Print conditional objects in array: +- Print multi-conditional objects in array: `{{cat path/to/file.json}} | jq '.[] | select((.key1=="value1") and .key2=="value2")'`