ansible/ansible — pull request #2119 by jpmens (2013-02-18 13:46:10+00:00)
Title: uri: load JSON for content-type: application/json

If the resource consumed by URI returns JSON, load JSON from the returned content string.

Sample playbook:

```yaml
- action: uri
url="http://localhost/jp.cgi"
dest=/tmp/ph
return_content=true
register: body
- action: template src=t1.j2 dest=/tmp/t1
```

Example template:

```
name = {{ body['json']['name'] }}
```

Example CGI

```sh
#!/bin/sh

echo "Content-type: application/json"
echo ""
echo '{ "name": "Jane Jolie", "number" : 49 }'
```