<Json, REST API> Json Test

REST APIの実験をかねて、Jsonのデータを返してくれるようなとこないかな? と探したらあった。

http://www.jsontest.com/

こりゃいいや。
早速試す。

In [1]: import requests

In [2]: requests.get('http://echo.jsontest.com/key/value/one/two')
Out[2]: <Response [200]>

In [3]: r = requests.get('http://echo.jsontest.com/key/value/one/two')

In [4]: r.content
Out[4]: b'{\n   "one": "two",\n   "key": "value"\n}\n'

In [5]: import json

In [8]: r.content.decode('utf-8')
Out[8]: '{\n   "one": "two",\n   "key": "value"\n}\n'

In [10]: json.loads(r.content.decode('utf-8'))
Out[10]: {'key': 'value', 'one': 'two'}

いける。 いけるじょー。