Thursday, 13 May 2021

Jq: pipe : combine two filters

‘jq’ command support Unix | kind of syntax to combine two filters.

 

empPretty.json 

{
	"org": [{
		"name": "Honeywell",
		"yrsOfExperience": 2.2
	}, {
		"name": "IBM",
		"yrsOfExperience": 1.8
	}],
	"firstName": "Krishna",
	"lastName": "Ram",
	"address": {
		"city": "Bangalore",
		"country": "India"
	}
}

 

For example, '.address.city' is same as '.address | .city'

$cat empPretty.json | jq '.address | .city'
"Bangalore"
$
$cat empPretty.json | jq '.address.city'
"Bangalore"

 

 

 

 

Previous                                                    Next                                                    Home

No comments:

Post a Comment