r.json() is used to decode JSON Data in case the response is json data.
In case the JSON decoding fails, r.json raises an exception. For example, if the response gets a 204 (No Content), or if the response contains invalid JSON, attempting r.json raises ValueError: No JSONobject could be decoded.
r=requests.get(url) r.json()
import requests r=requests.get('http://api.duckduckgo.com/?q=valley+forge+national+park&format=json&pretty=1') data=r.json() #data is JSON Data
JSON Data.