Blueprint

Import a Data Layer from JSON

Paste a JSON sample of a live data layer and Blueprint turns every leaf value into a documented object, with its path, an example value and a data type.

When to use it

Writing objects one by one is slow for a large data layer. If the site already publishes one, copy it from a real page and import it. You then delete the entries you do not need and fill in descriptions.

Before you start

  • Create the data layer first. See Document a Data Layer.
  • Get the JSON. On a page of the site, open the browser console and run, for example, JSON.stringify(digitalData) or JSON.stringify(dataLayer), then copy the output.

Import

  1. In Blueprint, click Data Layers.
  2. On the data layer's row, click the upload icon. The page opens as Import into followed by the data layer's title.
  3. Pick the Type of the objects you are importing.
  4. Paste the JSON into the JSON box.
  5. Click Submit.

You return to the data layer with the message "JSON was imported into data layer successfully."

What gets created

Each leaf value in the JSON becomes one object:

Imported fieldComes from
PathThe key path, for example page.pageInfo.pageName
Example ValueThe value found in your sample
Data TypeWorked out from the value: string, number, float (a number with a decimal point), boolean, and so on
TypeThe Type you picked

Arrays of plain values are imported as one object. Arrays of objects are walked into, and their positions are stored as [N], so ten products in a sample become one set of [N] paths, not ten.

Paths that already exist in the data layer are skipped, so re-importing a newer sample only adds the new keys.

Check it worked

Open the data layer. The Keys tab count has gone up, and the JSON tab shows the imported structure.

Troubleshooting

ProblemCause and fix
Nothing was importedThe box was empty or the text is not valid JSON. Paste the raw output of JSON.stringify(...), without surrounding quotes
"Please specify one or more valid data layer content"No objects were found in the pasted JSON
Paths starting with digitalData. show as W3C CEDDLBlueprint always stores those as W3C CEDDL, without the prefix