[Solved] How to extract a value from a json string?


@Hope, you’re right, json.loads() works in your example, though I’m not sure how the object_hook option works or if it would even be necessary. This should do what your asking:

import urllib, json
url="https://en.wikipedia.org/w/api.php?action=query&format=json&prop=langlinks&list=&titles=tallinn&lllimit=10"
response = urllib.urlopen(url)
data = json.loads(response.read())
print data['continue']['llcontinue']

output:
31577|bat-smg

With this you should be able to get the language values you’re after.

1

solved How to extract a value from a json string?