added try/catch 

added try/catch around the json.loads just in case the json is invalid or there is no json