def parse(out):
    jsonret = []
    in_json = False
    for ln_ in out.split('\n'):
        if '{' in ln_:
            in_json = True
        if in_json:
            jsonret.append(ln_)
        if '}' in ln_:
            in_json = False
    return json.loads('\n'.join(jsonret))
Extract json from out.
dataset/ETHPy150Open saltstack/salt/salt/proxy/ssh_sample.py/parse