Importing via JSON

Updated 1 month ago by Alex Cota

Uploading your data with a JSON file provides most flexibility. When you import your external image URLs with a JSON file, you have the option to attach an external ID and metadata information to each of your assets.

Step 1: Format JSON file

imageUrl (REQUIRED): HTTP or HTTPS path to the external image URL.

externalId: Allows the user to tie a piece of data in the Labelbox database to a piece of data in a database outside of Labelbox.

info: The JSON object where a user can assign the metaType a metaValue to provide more information about the asset.

type: Allows the user to specify the media type attached to your asset: IMAGE, VIDEO, or TEXT.

value: Paths to external URLs are rendered on the web page as a video or image embed. Text strings that are not paths are simply rendered as text.

The data input format for custom editors is slightly different. See the documentation for Custom image selection interface for an example.

[ 
{
"externalId": "ab65d5e99w13",
"imageUrl": "https://storage.googleapis.com/labelbox-a.jpg",
"info": {
"type": "IMAGE",
"value": "https://firebasestorage.googleapis.com/v0/b/"
}
},
{
"externalId": "ljk6s544a7f8",
"imageUrl": "https://storage.googleapis.com/labelbox-b.jpg",
"info": {
"type": "VIDEO",
"value": "http://commondatastorage.googleapis.com/b.mp4"
}
},
{
"externalId": "ljk6s544a7f8",
"imageUrl": "https://storage.googleapis.com/labelbox-c.jpg",
"info": {
"type": "TEXT",
"value": "Lorem ipsum dolor sit amet."
}
}
]

Step 2: Import JSON file

There are three methods for importing your data via JSON.

Labelbox web app

If you have a paid Labelbox account, you can upload new data via JSON or CSV in the Labelbox web application.

Python API

If you have an API key, you may import your data as a JSON file using our Python API. For more detail, see the documentation for the create_data_rows() method in our Python API reference.

GraphQL API

To learn how to use the appendRowsToDataset GraphQL mutation to import a JSON file, see How to import data.

Advanced JSON imports

  1. Asset information overlay
  2. Import text
  3. Import tiled imagery (slippy maps)
  4. Import custom data structure


Was this page helpful?