Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ jq --version
- jq-1.4
- $ cat zout | jq -r -M .
- {
- "rbac-service": {
- "service_version": "0.6.38",
- "service_status_version": 1,
- "detail_level": "info",
- "state": "running",
- "status": {
- "db_up": true,
- "activity_up": true
- }
- },
- "activity-service": {
- "service_version": "0.3.6",
- "service_status_version": 1,
- "detail_level": "info",
- "state": "running",
- "status": {
- "db_up": true
- }
- },
- "classifier-service": {
- "service_version": "1.5.15",
- "service_status_version": 1,
- "detail_level": "info",
- "state": "running",
- "status": {
- "environment_sync": true,
- "db_up": true,
- "rbac_up": true,
- "activity_up": true
- }
- }
- }
- Desired output: (need the value of the "state" key from the child dictionaries)
- {
- "rbac-service": "running",
- "activity-service": "running",
- "classifier-service": "running"
- }
- For future reference, this is the answer I received when I asked about it on Freenode #jq ...
- $ cat zout | jq -r -M 'with_entries(.value |= .state)'
- {
- "activity-service": "running",
- "classifier-service": "running",
- "rbac-service": "running"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement