$ echo '{"hosts":[{"name":"host1"},{"name":"host2"}]}' | python -c "exec(\"import json,sys\\nj=json.load(sys.stdin)\\nfor attr in j.get('hosts'):\\n print attr.get('name')\")"
host1
host2
Created
May 27, 2014 11:26
-
-
Save tkuchiki/89ddb0dd9cdb863316fc to your computer and use it in GitHub Desktop.
json 文字列を受けとって、任意のキーの値を出力する
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment