def _load_json_data(data, data_folder, multi_label=False):
    """Utility method to extract data from Label Studio json files."""
    results = []
    test_results = []
    data_types = set()
    tag_types = set()
    classes = set()
    for task in data:
        for annotation in task["annotations"]:
            # extracting data types from tasks
            for key in task.get("data"):
                data_types.add(key)
            # Adding ground_truth annotation to separate dataset
            result = annotation["result"]
            for res in result:
                t = res["type"]
                tag_types.add(t)
                for label in res["value"][t]:
                    # check if labeling result is a list of labels
                    if isinstance(label, list) and not multi_label:
                        for sublabel in label:
                            classes.add(sublabel)
                            temp = {
                                "file_upload": task.get("file_upload"),
                                "data": task.get("data"),
                                "label": sublabel,
                                "result": res.get("value"),
                            }
                            if temp["file_upload"]:
                                temp["file_upload"] = os.path.join(data_folder, temp["file_upload"])
                            else:
                                for key in temp["data"]:
                                    p = temp["data"].get(key)
                                path = Path(p)
                                if path and data_folder:
                                    temp["file_upload"] = os.path.join(data_folder, path.name)
                            if annotation["ground_truth"]:
                                test_results.append(temp)
                            elif not annotation["ground_truth"]:
                                results.append(temp)
                    else:
                        if isinstance(label, list):
                            for item in label:
                                classes.add(item)
                        else:
                            classes.add(label)
                        temp = {
                            "file_upload": task.get("file_upload"),
                            "data": task.get("data"),
                            "label": label,
                            "result": res.get("value"),
                        }
                        if temp["file_upload"] and data_folder:
                            temp["file_upload"] = os.path.join(data_folder, temp["file_upload"])
                        else:
                            for key in temp["data"]:
                                p = temp["data"].get(key)
                            path = Path(p)
                            if path and data_folder:
                                temp["file_upload"] = os.path.join(data_folder, path.name)
                        if annotation["ground_truth"]:
                            test_results.append(temp)
                        elif not annotation["ground_truth"]:
                            results.append(temp)
    return results, test_results, classes, data_types, tag_types
Utility method to extract data from Label Studio json files.
src/flash/core/integrations/labelstudio/input.py