I'm not sure what your JSON structure looks like and what it contains - but how are you loading it? If you're working with dataframes and/or using the json library, you should be using the json.loads() or pd.read_json() methods. Try using that and see if that works at first? I think when you're making this statement:
variables = json_dict.get( 'variables', None )
The variables assignment might be returning a None type or an empty result. Could you check if this is working first before you run your condition block? I'm assuming your json_dict is a dictionary of dictionaries, and what you want is a dictionary of strings.