import json


def ocr_loader(json_path):
    """Helper function to load ocr data from json file

    Args:
        json_path (string):
            Path to the json file with OCR output data

    Returns:
        string:
            OCR text output
    """
    json_path = json_path.replace('\\', '/')
    with open(json_path, "r") as file:
        loaded_json = json.load(file)
        if type(loaded_json) is list:
            result = loaded_json
        else:
            result = loaded_json['text']
        return " ".join(result)