Generate a Python code snippet to extract the rate of inflation for a given year from a given JSON.
JSON data with rate of inflation for years 2017-2020
import json

data = '{"2017":2.2,"2018":2.4,"2019":1.7,"2020":0.1}'

inflation_data = json.loads(data)
inflation_rate = inflation_data["2020"] 
print(inflation_rate)  # Output: 0.1