# jq

## Examples

### Get `RestartPolicy` from Docker container

```
# docker inspect container1 | jq '.[].HostConfig.RestartPolicy.Name'
"unless-stopped"
```

### Get `RestartPolicy` from multiple containers in new JSON object list

```
# docker inspect container1 container2 | jq '[.[] | {policy_name: .HostConfig.RestartPolicy.Name, name: .Name}]'
[
  {
    "policy_name": "unless-stopped",
    "name": "container1"
  },
  {
    "policy_name": "unless-stopped",
    "name": "container2"
  }
]
```
