Defining the schema of your JSON file - 7.1

Talend Data Management Platform Studio User Guide

author
Talend Documentation Team
EnrichVersion
7.1
EnrichProdName
Talend Data Management Platform
task
Design and Development
EnrichPlatform
Talend Studio

About this task

In this step, you will set the schema parameters.

The schema definition window is composed of four views:

View

Description

Source Schema

Tree view of the JSON file.

Target Schema

Extraction and iteration information.

Preview

Preview of the target schema, together with the input data of the selected columns displayed in the defined order.

File Viewer

Preview of the JSON file's data.

Procedure

  1. Populate the Path loop expression field with the absolute JsonPath or XPath expression, depending on the type of query you have selected, for the node to be iterated upon. There are two ways to do this, either:
    • enter the absolute JsonPath or XPath expression for the node to be iterated upon (enter the full expression or press Ctrl+Space to use the autocompletion list),

    • drag the loop element node from the tree view under Source schema into the Absolute path expression field of the Path loop expression table.

      An orange arrow links the node to the corresponding expression.
    Note: The Path loop expression definition is mandatory.
  2. In the Loop limit field, specify the maximum number of times the selected node can be iterated.
  3. Define the fields to be extracted by dragging the nodes from the Source Schema tree into the Relative or absolute path expression fields of the Fields to extract table.
    Note: You can select several nodes to drop onto the table by pressing Ctrl or Shift and clicking the nodes of interest.
  4. If needed, you can add as many columns to be extracted as necessary, delete columns or change the column order using the toolbar:
    • Add or delete a column using the [+] and x buttons.

    • Change the order of the columns using the and buttons.

  5. If you want your file schema to have different column names than those retrieved from the input file, enter new names in the corresponding Column name fields.
  6. Click Refresh Preview to preview the target schema. The fields are consequently displayed in the schema according to the defined order.
  7. Click Next to finalize the schema.