import json


def _convert_vars_to_json(env_dict):
    """Converts 'variables' in the given environment dict into string."""
    if ('variables' in env_dict and
            isinstance(env_dict.get('variables'), dict)):
        env_dict['variables'] = json.dumps(env_dict['variables'])

    return env_dict