(json_text)
return new_json
Strip settings parameter in json_text to only contain execute options
    Deletes the 'settings' parameter if there are no execute options.
Strip settings parameter in json_text to only contain execute options
    Deletes the 'settings' parameter if there are no execute options.
Strip settings parameter in json_text to only contain execute options Deletes the settings parameter if there are no execute options .
def strip_json(json_text):
    """
    Strip settings parameter in json_text to only contain execute options
    Deletes the 'settings' parameter if there are no execute options.
    """

    try:
        local_dict = toml.loads(json_text)
    except Exception as exep:
        logger.error(f'Error loading json text: {exep}, {json_text}')
        return json_text

    # Fetch the execute options
    execute_options = local_dict.get('settings', {}).get('execute', {})
    data_options = local_dict.get('settings', {}).get('create', {})

    # Check to see if it is present
    if execute_options or data_options:
        # Strip run settings of every thing but execute options
        local_dict['settings'] = dict(execute=execute_options, create=data_options)
    else:
        # NOTE: Delete 'settings' from json text
        local_dict['settings'] = ''
        del local_dict['settings']

    new_json = toml.dumps(local_dict)

    return new_json
def strip_json ( json_text ) : try : local_dict = toml . loads ( json_text ) except Exception as exep : logger . error ( f'Error loading json text: {exep}, {json_text}' ) return json_text # Fetch the execute options execute_options = local_dict . get ( 'settings' , { } ) . get ( 'execute' , { } ) data_options = local_dict . get ( 'settings' , { } ) . get ( 'create' , { } ) # Check to see if it is present if execute_options or data_options : # Strip run settings of every thing but execute options local_dict [ 'settings' ] = dict ( execute = execute_options , create = data_options ) else : # NOTE: Delete 'settings' from json text local_dict [ 'settings' ] = '' del local_dict [ 'settings' ] new_json = toml . dumps ( local_dict ) return new_json