0
は、いくつかのランダムなwebserviceからいくつかのデータをフェッチ以下ハンドブックを考える:JSONを再注文することを不可能にする方法はありますか?
---
- name: sorting json
hosts: localhost
tasks:
- name:
uri:
url: http://jsonplaceholder.typicode.com/users
method: GET
return_content: yes
register: result
ignore_errors: yes
- debug: msg="{{result.content}}"
AnsibleはJSON出力再命令される:
出力(配列の最初の要素、並べ替え):
{
"address": {
"city": "Gwenborough",
"geo": {
"lat": "-37.3159",
"lng": "81.1496"
},
"street": "Kulas Light",
"suite": "Apt. 556",
"zipcode": "92998-3874"
},
"company": {
"bs": "harness real-time e-markets",
"catchPhrase": "Multi-layered client-server neural-net",
"name": "Romaguera-Crona"
},
"email": "[email protected]",
"id": 1,
"name": "Leanne Graham",
"phone": "1-770-736-8031 x56442",
"username": "Bret",
"website": "hildegard.org"
},
一方を元のデータは次のとおりです。
{
"id": 1,
"name": "Leanne Graham",
"username": "Bret",
"email": "[email protected]",
"address": {
"street": "Kulas Light",
"suite": "Apt. 556",
"city": "Gwenborough",
"zipcode": "92998-3874",
"geo": {
"lat": "-37.3159",
"lng": "81.1496"
}
},
"phone": "1-770-736-8031 x56442",
"website": "hildegard.org",
"company": {
"name": "Romaguera-Crona",
"catchPhrase": "Multi-layered client-server neural-net",
"bs": "harness real-time e-markets"
}
}
並べ替えがされていない整形済みJSONを取得するにはどうすればよいですか? (私はthis questionを見てきました、それが可能だった場合、それはまだいいだろう)