import json


def load_output(results):
    """Load json result from broker.

    """
    if results['Code'] == '0':
        try:
            var = json.loads(results['Stdout'])
        except Exception as e:
            raise Exception('JSON load failed: {}'.format(e))
    else:
        raise Exception('Operation failed: {}'.format(results['Stderr']))
    return var