import json


def parse_fio_output_file(fpath: str) -> dict:
    """ Read and parse json from fio json outputs """
    lines = []

    with open(fpath, 'r') as fiof:
        do_append = False
        for l in fiof:
            if l.startswith('{'):
                do_append = True

            if do_append:
                lines.append(l)

            if l.startswith('}'):
                break

    try:
        return json.loads(''.join(lines))
    except json.decoder.JSONDecodeError:
        return {}