Specified encoding for json.dumps
Changed variable name from json to data to avoid confusion