Export HTML annotations

How to export HTML data and sample export formats.

Export JSON annotations

# Set the export params to include/exclude certain fields. 
export_params= {
  "attachments": True,
  "metadata_fields": True,
  "data_row_details": True,
  "project_details": True,
  "label_details": True,
  "performance_details": True,
  "interpolated_frames": True
}

# Note: Filters follow AND logic, so typically using one filter is sufficient.
filters= {
  "last_activity_at": ["2000-01-01 00:00:00", "2050-01-01 00:00:00"],
  "workflow_status": "<wkf-status>"
}

export_task = project.export(params=export_params, filters=filters)
export_task.wait_till_done()


# Return JSON output strings from export task results/errors, one by one:

# Callback used for JSON Converter
def json_stream_handler(output: lb.BufferedJsonConverterOutput):
  print(output.json)


if export_task.has_errors():
  export_task.get_buffered_stream(
  stream_type=lb.StreamType.ERRORS
  ).start(stream_handler=lambda error: print(error))

if export_task.has_result():
  export_json = export_task.get_buffered_stream(
    stream_type=lb.StreamType.RESULT
  ).start(stream_handler=json_stream_handler)

print("file size: ", export_task.get_total_file_size(stream_type=lb.StreamType.RESULT))
print("line count: ", export_task.get_total_lines(stream_type=lb.StreamType.RESULT))
     

Annotation export formats

Classification - Radio

{
  "feature_id": "clgva8bo5hmfs1401auduvxht",
  "feature_schema_id": "clgva7wwb0l9r07x54f9h826z",
  "name": "radio_html",
  "value": "radio_html",
  "radio_answer": {
    "feature_id": "clgva8bo5hmft1401nhfbg7ja",
    "feature_schema_id": "clgva7wwb0l9u07x55fyxa5g3",
    "name": "second_radio_answer",
    "value": "second_radio_answer",
    "classifications": []
  }
}

Classification - Checklist

{
  "feature_id": "clgva8bo5hmfp14016xok5j73",
  "feature_schema_id": "clgva7wwa0l9l07x558vydexo",
  "name": "checklist_html",
  "value": "checklist_html",
  "checklist_answers": [
    {
      "feature_id": "clgva8bo5hmfq1401xnngji4s",
      "feature_schema_id": "clgva7wwb0l9m07x5671qe9ej",
      "name": "first_checklist_answer",
      "value": "first_checklist_answer",
      "classifications": []
    },
    {
      "feature_id": "clgva8bo5hmfr1401w191mdo5",
      "feature_schema_id": "clgva7wwb0l9o07x5h08p9572",
      "name": "second_checklist_answer",
      "value": "second_checklist_answer",
      "classifications": []
    }
  ]
}

Classification - Free-form text

{
  "feature_id": "clgva8bo5hmfo140186f07jci",
  "feature_schema_id": "clgva7wwa0l9j07x51e4t0bq8",
  "name": "text_html",
  "value": "text_html",
  "text_answer": {
    "content": "sample text"
  }
}

Sample project export

{
  "data_row": {
    "id": "clfskiyrx0e0q078k40evbanc",
    "global_key": "sample_html_1.html",
    "row_data": "https://storage.googleapis.com/labelbox-datasets/html_sample_data/sample_html_1.html",
    "details": {
      "dataset_id": "clfskixq70ym7071scn9l16z0",
      "dataset_name": "html_annotation_import_demo_dataset",
      "created_at": "2023-03-28T18:05:11.000+00:00",
      "updated_at": "2024-01-19T23:05:36.279+00:00",
      "last_activity_at": "2023-04-24T20:19:59.000+00:00",
      "created_by": "[email protected]"
    }
  },
  "media_attributes": {
    "mime_type": "text/html"
  },
  "attachments": [],
  "metadata_fields": [],
  "projects": {
    "clgva7x400opk07x73jgs6p8o": {
      "name": "HTML Import Annotation Demo",
      "labels": [
        {
          "label_kind": "Default",
          "version": "1.0.0",
          "id": "clgva8bonhmg21401hcpq6tee",
          "label_details": {
            "created_at": "2023-04-24T20:19:59.000+00:00",
            "updated_at": "2023-04-24T20:19:59.000+00:00",
            "created_by": "[email protected]",
            "content_last_updated_at": "2023-04-24T20:19:59.466+00:00",
            "reviews": []
          },
          "performance_details": {
            "seconds_to_create": 0,
            "seconds_to_review": 0,
            "skipped": false
          },
          "annotations": {
            "objects": [],
            "classifications": [
              {
                "feature_id": "clgva8bo5hmfo140186f07jci",
                "feature_schema_id": "clgva7wwa0l9j07x51e4t0bq8",
                "name": "text_html",
                "value": "text_html",
                "text_answer": {
                  "content": "sample text"
                }
              },
              {
                "feature_id": "clgva8bo5hmfp14016xok5j73",
                "feature_schema_id": "clgva7wwa0l9l07x558vydexo",
                "name": "checklist_html",
                "value": "checklist_html",
                "checklist_answers": [
                  {
                    "feature_id": "clgva8bo5hmfq1401xnngji4s",
                    "feature_schema_id": "clgva7wwb0l9m07x5671qe9ej",
                    "name": "first_checklist_answer",
                    "value": "first_checklist_answer",
                    "classifications": []
                  },
                  {
                    "feature_id": "clgva8bo5hmfr1401w191mdo5",
                    "feature_schema_id": "clgva7wwb0l9o07x5h08p9572",
                    "name": "second_checklist_answer",
                    "value": "second_checklist_answer",
                    "classifications": []
                  }
                ]
              },
              {
                "feature_id": "clgva8bo5hmfs1401auduvxht",
                "feature_schema_id": "clgva7wwb0l9r07x54f9h826z",
                "name": "radio_html",
                "value": "radio_html",
                "radio_answer": {
                  "feature_id": "clgva8bo5hmft1401nhfbg7ja",
                  "feature_schema_id": "clgva7wwb0l9u07x55fyxa5g3",
                  "name": "second_radio_answer",
                  "value": "second_radio_answer",
                  "classifications": []
                }
              },
              {
                "feature_id": "clgva8bo5hmfu1401yuz7wvuy",
                "feature_schema_id": "clgva7wwb0l9x07x57si1gihw",
                "name": "nested_checklist_question",
                "value": "nested_checklist_question",
                "checklist_answers": [
                  {
                    "feature_id": "clgva8bo6hmfv14015d33m625",
                    "feature_schema_id": "clgva7wwb0l9y07x5dt6l44qv",
                    "name": "first_checklist_answer",
                    "value": "first_checklist_answer",
                    "classifications": [
                      {
                        "feature_id": "clgva8bo6hmfw1401u59hfep5",
                        "feature_schema_id": "clgva7wwb0l9z07x5bvtx0agv",
                        "name": "sub_checklist_question",
                        "value": "sub_checklist_question",
                        "checklist_answers": [
                          {
                            "feature_id": "clgva8bo6hmfx14018asstw29",
                            "feature_schema_id": "clgva7wwb0la007x515qu9lje",
                            "name": "first_sub_checklist_answer",
                            "value": "first_sub_checklist_answer",
                            "classifications": []
                          }
                        ]
                      }
                    ]
                  }
                ]
              },
              {
                "feature_id": "clgva8bo6hmfy1401bivtvjjt",
                "feature_schema_id": "clgva7wwb0la507x583lg7mvf",
                "name": "nested_radio_question",
                "value": "nested_radio_question",
                "radio_answer": {
                  "feature_id": "clgva8bo6hmfz1401y555xn92",
                  "feature_schema_id": "clgva7wwb0la607x5h39u2z31",
                  "name": "first_radio_answer",
                  "value": "first_radio_answer",
                  "classifications": [
                    {
                      "feature_id": "clgva8bo6hmg01401agmna01o",
                      "feature_schema_id": "clgva7wwb0la707x5hxwe16bo",
                      "name": "sub_radio_question",
                      "value": "sub_radio_question",
                      "radio_answer": {
                        "feature_id": "clgva8bo6hmg11401dzqw0od8",
                        "feature_schema_id": "clgva7wwb0la807x51792e6il",
                        "name": "first_sub_radio_answer",
                        "value": "first_sub_radio_answer",
                        "classifications": []
                      }
                    }
                  ]
                }
              }
            ],
            "relationships": []
          }
        }
      ],
      "project_details": {
        "ontology_id": "clgva7wto0l9i07x5emb8b4uo",
        "task_name": "Done",
        "batch_id": "5ba71600-e2dd-11ed-8ee3-e3123dc756e1",
        "batch_name": "first-batch-html-demo",
        "workflow_status": "DONE",
        "priority": 5,
        "consensus_expected_label_count": 1,
        "workflow_history": []
      }
    }
  }
}

Sample model run export

{
  "data_row": {
    "id": "clfcvkqx708ba079n4nfo1drf",
    "global_key": "sample_html_2.html",
    "row_data": "https://storage.googleapis.com/labelbox-datasets/html_sample_data/sample_html_2.html",
    "details": {
      "dataset_id": "clfcvkpzc0v8l07yt9vhc16sv",
      "dataset_name": "html demo dataset",
      "created_at": "2023-03-17T18:30:11.000+00:00",
      "updated_at": "2024-01-19T22:55:40.282+00:00",
      "created_by": "[email protected]"
    }
  },
  "media_attributes": {
    "mime_type": "text/html"
  },
  "attachments": [],
  "metadata_fields": [],
  "experiments": {
    "a414cfe7-f6ab-094b-8307-68d5a7272397": {
      "name": "HTML_model_run_1d21d941-f392-41e9-85d4-a52b3a3b5bfd",
      "runs": {
        "a414cfe8-690d-0b10-6b9f-7e9bf6a7dd1c": {
          "name": "iteration 1",
          "run_data_row_id": "d2bdab47-af16-4052-a310-74fa324cda5f",
          "labels": [
            {
              "label_kind": "Default",
              "version": "1.0.0",
              "id": "cluu1x19z0out148p9vadgmcu",
              "annotations": {
                "objects": [],
                "classifications": [
                  {
                    "feature_id": "3625d4eb-ca0f-0385-9c74-c3538b40621c",
                    "feature_schema_id": "cluu1wl30002007wo1gnn8htz",
                    "name": "free_text",
                    "value": "free_text",
                    "text_answer": {
                      "content": "sample text"
                    }
                  },
                  {
                    "feature_id": "47d39827-416f-042f-a9f5-7d5bf45ba884",
                    "feature_schema_id": "cluu1wl2z001k07wo17r02qrr",
                    "name": "nested_radio_question",
                    "value": "nested_radio_question",
                    "radio_answer": {
                      "feature_id": "89c36638-ec65-095c-893a-49417a1611fc",
                      "feature_schema_id": "cluu1wl2z001l07wo6kll5fc0",
                      "name": "first_radio_answer",
                      "value": "first_radio_answer",
                      "classifications": [
                        {
                          "feature_id": "5de3b3eb-78a8-06e8-b420-491234d05743",
                          "feature_schema_id": "cluu1wl2z001m07wodiwh0hjp",
                          "name": "sub_radio_question",
                          "value": "sub_radio_question",
                          "radio_answer": {
                            "feature_id": "684b6ca5-e5d4-0684-991d-597e5ea76700",
                            "feature_schema_id": "cluu1wl2z001n07wo8ey5f1yw",
                            "name": "first_sub_radio_answer",
                            "value": "first_sub_radio_answer",
                            "classifications": []
                          }
                        }
                      ]
                    }
                  },
                  {
                    "feature_id": "9297d521-2b0a-04bd-b88b-b5512b85ec20",
                    "feature_schema_id": "cluu1wl2z001s07woc5xmcz68",
                    "name": "checklist_question",
                    "value": "checklist_question",
                    "checklist_answers": [
                      {
                        "feature_id": "add68a9d-01b1-039a-bbdf-c96f63d408e6",
                        "feature_schema_id": "cluu1wl30001v07wocp3hg8a0",
                        "name": "second_checklist_answer",
                        "value": "second_checklist_answer",
                        "classifications": []
                      },
                      {
                        "feature_id": "ce4eca3a-b2f5-0861-954f-ad7ff07c1a7f",
                        "feature_schema_id": "cluu1wl30001x07wobpdwgf4w",
                        "name": "third_checklist_answer",
                        "value": "third_checklist_answer",
                        "classifications": []
                      },
                      {
                        "feature_id": "fab6d119-206f-0b6d-a5a7-8a08e17ed8cf",
                        "feature_schema_id": "cluu1wl2z001t07wobsowcibp",
                        "name": "first_checklist_answer",
                        "value": "first_checklist_answer",
                        "classifications": []
                      }
                    ]
                  },
                  {
                    "feature_id": "9c1c6bad-ca20-08c9-8d1a-78907e65ebe4",
                    "feature_schema_id": "cluu1wl2z001g07wo5elxfwut",
                    "name": "radio_question",
                    "value": "radio_question",
                    "radio_answer": {
                      "feature_id": "28ea7b46-b891-0285-a8a3-3ba7a30cdeb4",
                      "feature_schema_id": "cluu1wl2z001h07wo760uc0sb",
                      "name": "first_radio_answer",
                      "value": "first_radio_answer",
                      "classifications": []
                    }
                  },
                  {
                    "feature_id": "d48dce83-f514-0728-9b5a-deb045493dc3",
                    "feature_schema_id": "cluu1wl30002207woa3u870v7",
                    "name": "nested_checklist_question",
                    "value": "nested_checklist_question",
                    "checklist_answers": [
                      {
                        "feature_id": "ca4f111b-c6f6-013a-a38e-0ce1ee77b370",
                        "feature_schema_id": "cluu1wl30002307wogixwdc5z",
                        "name": "first_checklist_answer",
                        "value": "first_checklist_answer",
                        "classifications": [
                          {
                            "feature_id": "6d08884d-ff25-0a41-a5aa-875e6385ea1e",
                            "feature_schema_id": "cluu1wl30002407woea6e102z",
                            "name": "sub_checklist_question",
                            "value": "sub_checklist_question",
                            "checklist_answers": [
                              {
                                "feature_id": "02db9eb9-6763-0a2c-92ee-cdf3b11b8de4",
                                "feature_schema_id": "cluu1wl30002507wo07av3u9e",
                                "name": "first_sub_checklist_answer",
                                "value": "first_sub_checklist_answer",
                                "classifications": []
                              }
                            ]
                          }
                        ]
                      }
                    ]
                  }
                ],
                "relationships": []
              }
            }
          ],
          "predictions": [
            {
              "label_kind": "Default",
              "version": "1.0.0",
              "id": "cluu1x19z0out148p9vadgmcu",
              "annotations": {
                "objects": [],
                "classifications": [
                  {
                    "feature_id": "162ea9d9-c6e8-48e9-b4fe-1beb5ec35e71",
                    "feature_schema_id": "cluu1wl2z001k07wo17r02qrr",
                    "name": "nested_radio_question",
                    "value": "nested_radio_question",
                    "radio_answer": {
                      "feature_id": "ecdb63be-bd8b-4768-ab51-6399e38c3fd8",
                      "feature_schema_id": "cluu1wl2z001l07wo6kll5fc0",
                      "name": "first_radio_answer",
                      "value": "first_radio_answer",
                      "classifications": [
                        {
                          "feature_id": "9bdb8546-6ee7-4993-bea7-9de7d1d4f0d5",
                          "feature_schema_id": "cluu1wl2z001m07wodiwh0hjp",
                          "name": "sub_radio_question",
                          "value": "sub_radio_question",
                          "radio_answer": {
                            "feature_id": "a0466f11-c940-4217-9589-56f261425e43",
                            "feature_schema_id": "cluu1wl2z001n07wo8ey5f1yw",
                            "name": "first_sub_radio_answer",
                            "value": "first_sub_radio_answer",
                            "classifications": []
                          }
                        }
                      ]
                    }
                  },
                  {
                    "feature_id": "2b7e8e1b-a55d-4ac6-80e2-629bc64c5b97",
                    "feature_schema_id": "cluu1wl30002007wo1gnn8htz",
                    "name": "free_text",
                    "value": "free_text",
                    "text_answer": {
                      "content": "sample text"
                    }
                  },
                  {
                    "feature_id": "347dd2d9-7729-4ebd-970a-c4eedb1d41cc",
                    "feature_schema_id": "cluu1wl30002207woa3u870v7",
                    "name": "nested_checklist_question",
                    "value": "nested_checklist_question",
                    "checklist_answers": [
                      {
                        "feature_id": "1a17cdf4-2159-4c21-b1d8-7b9490d8bb14",
                        "feature_schema_id": "cluu1wl30002307wogixwdc5z",
                        "name": "first_checklist_answer",
                        "value": "first_checklist_answer",
                        "classifications": [
                          {
                            "feature_id": "ab20eb98-3002-4108-a541-37741a9a1531",
                            "feature_schema_id": "cluu1wl30002407woea6e102z",
                            "name": "sub_checklist_question",
                            "value": "sub_checklist_question",
                            "checklist_answers": [
                              {
                                "feature_id": "31e09418-2b8e-4759-bd71-4f88302398ce",
                                "feature_schema_id": "cluu1wl30002507wo07av3u9e",
                                "name": "first_sub_checklist_answer",
                                "value": "first_sub_checklist_answer",
                                "classifications": []
                              }
                            ]
                          }
                        ]
                      }
                    ]
                  },
                  {
                    "feature_id": "70f54814-79c0-4d66-84c5-531e8b53e657",
                    "feature_schema_id": "cluu1wl2z001g07wo5elxfwut",
                    "name": "radio_question",
                    "value": "radio_question",
                    "radio_answer": {
                      "feature_id": "214cb3db-da72-4692-9fa4-c86e2933b11e",
                      "feature_schema_id": "cluu1wl2z001h07wo760uc0sb",
                      "name": "first_radio_answer",
                      "value": "first_radio_answer",
                      "classifications": []
                    }
                  },
                  {
                    "feature_id": "baa18a09-6626-48cb-9b4c-7d75aa7d8c57",
                    "feature_schema_id": "cluu1wl2z001s07woc5xmcz68",
                    "name": "checklist_question",
                    "value": "checklist_question",
                    "checklist_answers": [
                      {
                        "feature_id": "c1cf3d18-238f-4817-9fed-93c14954c153",
                        "feature_schema_id": "cluu1wl30001v07wocp3hg8a0",
                        "name": "second_checklist_answer",
                        "value": "second_checklist_answer",
                        "classifications": []
                      },
                      {
                        "feature_id": "cf4606ab-1a5b-4c50-87a3-1f2b5dfc9547",
                        "feature_schema_id": "cluu1wl30001x07wobpdwgf4w",
                        "name": "third_checklist_answer",
                        "value": "third_checklist_answer",
                        "classifications": []
                      },
                      {
                        "feature_id": "f4f28750-5a7f-4da0-a081-b4da8eacb667",
                        "feature_schema_id": "cluu1wl2z001t07wobsowcibp",
                        "name": "first_checklist_answer",
                        "value": "first_checklist_answer",
                        "classifications": []
                      }
                    ]
                  }
                ],
                "relationships": []
              }
            }
          ]
        }
      }
    }
  },
  "models": {}
}