‘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"
 
  
No comments:
Post a Comment