Productsup

Import JSON files - advanced settings

Learn how to import JSON files into Productsup using advanced settings in the platform.

JSON explained

JSON (JavaScript Object Notation) is a human-readable format for exchanging data between systems. It consists of key-value pairs that can look similar to this: {"id": "1111"}. In this example, id is the attribute key, and 1111 is the attribute value. In a JSON file, every key is enclosed in double quotation marks. Every value can be a string, array, object, or number. If a value is a string, it is also enclosed in double quotation marks.

Here is an example of a typical JSON file that stores data for one product in one object:

{
    "id": "1111",
    "title": "Shirt",
    "size": "L",
    "price": "30 EUR",
    "stock": "5"
}

If a JSON file stores data for multiple products, the file contains an array that opens and closes with a square bracket. Inside the array, each product is an object that opens and closes with a curly bracket:

[
    {
        "id": "1111",
        "title": "Shirt",
        "size": "L",
        "price": "30 EUR",
        "stock": "5"
    },
    {
        "id": "2222",
        "title": "Pants",
        "size": "S",
        "price": "60 EUR",
        "stock": "3"
    }
]

You can import your raw JSON files into Productsup using the following data source options:

To read and interpret JSON files correctly, the platform parses them before uploading their contents to your site. To ensure that parsing goes smoothly, you can use various JSON settings while setting up your data source option.

Nested JSON files with complex structures may require custom development efforts on the Productsup side to let the platform parse them correctly. Reach out to your Customer Success Manager or contact support@productsup.com if you need help.

Import a JSON file with a root node

Some JSON files have root nodes. A root node is a key that contains an array storing all your products. It serves as an entry point from which the platform should start importing products in your file.

The root node in the following example is products:

{ 
    "products": [
        {
            "id": "1111",
            "title": "Shirt",
            "size": "L",
            "price": "30 EUR",
            "stock": "5"
        },
        {
            "id": "2222",
            "title": "Pants",
            "size": "S",
            "price": "60 EUR",
            "stock": "3"
        }
    ]
}

If your JSON file contains a root node and you don't specify it on the data source setup page, the import fails.

To specify a root node for your JSON file:

Go to Data Sources from your site's main menu and select the cogwheel icon () next to the relevant data source.

Find the Content Options panel at the bottom of the data source setup page and select Json Settings.

In Root Node, enter the key that serves as a root node in your JSON file. Don't include quotation marks in this field; only add the name of the key, for example, products. UUID-6a229505-3b05-301f-fca9-8c13fd60e941 If your relevant root node is nested deep in the file's structure, you can use either option:

  1. Enter the name of the relevant key only.
  2. Specify the whole path leading up to the relevant key, such as products>garden-furniture>spring-collection.

Select Save all settings.

Import a JSON file with variant keys

If your products are available in multiple sizes or colors, your JSON file may store this data in variant keys in each product. In the following example, the variant key sizes-and-stock contains different sizes and the related stock data:

{
    "products": [
        {
            "id": "1111",
            "title": "Shirt",
            "price": "30 EUR",
            "sizes-and-stock": [
                {
                    "size": "L",
                    "stock": "5"
                },
                {
                    "size": "S",
                    "stock": "2"
                }
            ]
        },
        {
            "id": "2222",
            "title": "Pants",
            "price": "60 EUR",
            "sizes-and-stock": [
                {
                    "size": "L",
                    "stock": "3"
                },
                {
                    "size": "M",
                    "stock": "5"
                }
            ]
        }
    ]
}

When importing products with variant keys, the platform creates one row per product by default and adds new columns for all attributes and values stored within the variant key. This is why you get the following data in your site:

idtitlepricesizesandstock_0_sizesizesandstock_0_stocksizesandstock_1_sizesizesandstock_1_stock
1111Shirt30 EURL5S2
2222Pants60 EURL3M5

However, the platform can also import variant keys as separate product rows:

idtitlepricesizesandstock_sizesizesandstock_stock
1111Shirt30 EURL5
1111Shirt30 EURS2
2222Pants60 EURL3
2222Pants60 EURM5

To let the platform import variant keys as separate product rows, use the Variant Node setting on the data source page:

Go to Data Sources from your site's main menu and select the cogwheel icon () next to the relevant data source.

Find the Content Options panel at the bottom of the data source setup page and select Json Settings.

In Variant Node, enter the variant key of your JSON file. Don't include quotation marks in this field; only add the name of the key, for example, sizes-and-stock. UUID-afd1959b-18ed-cb84-3e62-97c533a0bb5a

If your file also has a root node, remember to enter it in Root Node. See Import a JSON file with a root node.

Select Save all settings.

Bundle repeating keys into one column

A JSON file may have a key with an array that stores multiple values. For example, see the size key:

{
    "id": "1111",
    "title": "Shirt",
    "price": "30 EUR",
    "size": [
            "XS",
            "M",
            "L"
    ]

}

By default, the platform creates a new column for each value in the array and imports the data as follows:

idtitlepricesize_0size_1size_2
1111Shirt30 EURXSML

However, you can bundle the repeating values into one column and let the platform import the data this way:

idtitlepricesize
1111Shirt30 EURXS, M, L

You can use any delimiter to separate values.

To bundle repeating values into one column:

Go to Data Sources from your site's main menu and select the cogwheel icon () next to the relevant data source.

Find the Content Options panel at the bottom of the data source setup page and select Json Settings.

Check the Bundle box to enable the setting.

In Bundle Delimiter, enter the symbol that should separate your repeating values in a column. The default separator is a comma (,). UUID-2acfc9b2-d635-fac0-9d68-c268267a03ce

If your file also has a root node, remember to enter it in Root Node. See Import a JSON file with a root node.

Select Save all settings.

Exclude specific keys from a JSON file

You can let the platform exclude specific keys during import. For example, you may want the platform not to import the key updatedOn into your Productsup site:

{
  "id": "1111",
  "title": "Shirt",
  "size": "L",
  "updatedOn": "17.04.2023"
}

To let the platform skip an unneeded key:

Go to Data Sources from your site's main menu and select the cogwheel icon () next to the relevant data source.

Find the Content Options panel at the bottom of the data source setup page and select Json Settings.

In Exclude Items, enter the key you want to skip during import. Don't include quotation marks in this field; only add the name of the key, for example, updatedOn. UUID-09dc17c7-6ac2-e1b0-6de3-845fb0d12084

Tip

To exclude multiple keys during import, separate them with a comma.

Select Save all settings.

Transform a JSON file into a CSV file

Some export channels prefer uploading CSV files rather than JSON files. In these cases, you may want to transform your JSON file into a CSV file before Productsup imports it:

Go to Data Sources from your site's main menu and select the cogwheel icon () next to the relevant data source.

Select the Advanced Settings tab and choose I/O Settings.

In the Transform JSON to CSV option, select Add. UUID-82429519-bd7b-e999-7791-e1caa7697616

Use the fields Product Path and Multiline to provide the platform with the needed transformation details. See Transform JSON to CSV to fill out these fields.

Select Save.

How is this guide?

On this page