Pulls a string from redis and deserializes it from json. Deserialized
    dictionary data loaded directly into top level if pillar_key is not set.

    pillar_key
        Pillar key to return data into

def key_json(minion_id,
             pillar,  # pylint: disable=W0613
             pillar_key=None):
    '''
    Pulls a string from redis and deserializes it from json. Deserialized
    dictionary data loaded directly into top level if pillar_key is not set.

    pillar_key
        Pillar key to return data into
    '''
    key_data = __salt__['redis.get_key'](minion_id)
    # Return nothing for non-existent keys
    if not key_data:
        return {}

    data = salt.utils.json.loads(key_data)
    # Return as requested
    if isinstance(data, dict) and not pillar_key:
        return data
    elif not pillar_key:
        return {'redis_pillar': data}
    else:
        return {pillar_key: data}