从 urllib2.open 和 UTF8 字符读取 JSON

Reading JSON from urllib2.open and UTF8 characters

我正在阅读 JSON 有:

# coding: utf8

import urllib2
import json

response = urllib2.urlopen('https://example.com/test.json')
data = json.load(response)

print data['mykey']

# {u'readme': u'Caf\xe9'}

但我看到两件事:

如何使用 Python 2.7 正确执行此操作?

>>> import json
>>> d = {u'readme': u'Caf\xe9'}
>>> json.dumps(d)
'{"readme": "Caf\u00e9"}'
>>> json.dumps(d, ensure_ascii=False)
'{"readme": "Café"}'