# json (jq)



```json
{
    "request_id": "9a081c0c-9401-7eca-f55d-50e3b7c0301c",
    "lease_id": "",
    "renewable": false,
    "lease_duration": 2764800,
    "data": {
        "password": "test123",
        "username": "testuser1"
    },
    "wrap_info": null,
    "warnings": null,
    "auth": null
}
```

```bash
$ jq '.data.password, .data.username' data.json
"test123"
"testuser1"
```



```json
{
  "langs": ["JavaScript", "Ruby"]
}
```

```bash
$ jq -r '.langs[]' languages.json
JavaScript
Ruby
```



```json
{
   "italian" : {
      "name" : [
         "gatto",
         "cane",
         "pasta",
         "telefono",
         "libro"
      ],
      "adjective" : [
         "pesante",
         "sottile",
         "giallo",
         "stretto"
      ]
   },
   "english" : {
      "name" : [
         "fish",
         "book",
         "guitar",
         "piano"
      ],
      "adjective" : [
         "dirty",
         "good",
         "ugly",
         "great"
      ]
   }
}
```

```bash
$ jq '.english.adjective[1]' file.js
good
```



### Loop

https://unix.stackexchange.com/questions/732602/create-a-json-using-bash-script

