Importing via JSON

Updated 6 days ago by Alex Cota

Uploading your data via JSON provides the most flexibility. When you import your external image URLs via JSON, you have the option to attach an external ID and metadata information to each of your assets. This action also known as "asset information overlay".

For instructions on how to add asset information via the GraphQL API, see Asset information overlay.

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: Metadata type attached to your asset: IMAGE, VIDEO, or TEXT.

value: URL to the asset metadata. 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.

Example:

[ 
{
"externalId": "ab65d5e99w13",
"imageUrl": "https://storage.googleapis.com/labelbox-example-datasets/tesla/2017-Tesla-Model-S-P90D-102.jpg",
"info": {
"type": "IMAGE",
"value": "https://firebasestorage.googleapis.com/v0/b/"
}
},
{
"externalId": "ljk6s544a7f8",
"imageUrl": "https://storage.googleapis.com/labelbox-example-datasets/tesla/2017-Tesla-Model-3-top-view.jpg",
"info": {
"type": "VIDEO",
"value": "http://commondatastorage.googleapis.com/b.mp4"
}
},
{
"externalId": "ljk6s544a7f8",
"imageUrl": "https://storage.googleapis.com/labelbox-example-datasets/tesla/2016-tesla-model-s-17-of-43.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 app.

Note: this is only available in our legacy image editor.

Python API

If you have an API key, you may import 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 the Bulk import documentation.

Advanced JSON imports

  1. Asset information overlay
  2. Import text
  3. Import image tiles
  4. Import custom data structure


Was this page helpful?