Defining the JSON schema of your output file - Cloud - 8.0

Talend Studio User Guide

Version
Cloud
8.0
Language
English
Product
Talend Big Data
Talend Big Data Platform
Talend Cloud
Talend Data Fabric
Talend Data Integration
Talend Data Management Platform
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Real-Time Big Data Platform
Module
Talend Studio
Content
Design and Development
Last publication date
2024-02-29

About this task

Upon completion of the previous operations, the columns in the Linker Source area are automatically mapped to the corresponding ones in the Linker Target area, as indicated by blue arrow links..

In this step, you need to define the output schema. To do so, you can perform different actions:
Action Instructions
Define a loop element In the Linker Target area, right-click the element of interest and select Set As Loop Element from the contextual menu.
Note: It is a mandatory operation to define an element to run a loop on.
Define a group element In the Linker Target area, right-click the element of interest and select Set As Group Element from the contextual menu.
Note: You can set a parent element of the loop element as a group element on the condition that the parent element is not the root of the JSON tree.
Create a child element for an element In the Linker Target area:
  • Right-click the element of interest and select Add Sub-element from the contextual menu, enter a name for the sub-element in the dialog box that appears, and click OK.
  • Select the element of interest, click the [+] button at the bottom, select Create as sub-element in the dialog box that appears, and click OK. Then, enter a name for the sub-element in the next dialog box and click OK.
Create an attribute for an element In the Linker Target area:
  • Right-click the element of interest and select Add Attribute from the contextual menu, enter a name for the attribute in the dialog box that appears, and click OK.
  • Select the element of interest, click the [+] button at the bottom, select Create as attribute in the dialog box that appears, and click OK. Then, enter a name for the attribute in the next dialog box and click OK.
Create a name space for an element In the Linker Target area:
  • Right-click the element of interest and select Add Name Space from the contextual menu, enter a name for the name space in the dialog box that appears, and click OK.
  • Select the element of interest, click the [+] button at the bottom, select Create as name space in the dialog box that appears, and click OK. Then, enter a name for the name space in the next dialog box and click OK.
Delete one or more elements, attributes, or name spaces In the Linker Target area:
  • Right-click the elements, attributes, or name spaces of interest and select Delete from the contextual menu.
  • Select the elements, attributes, or name spaces of interest and click the x button at the bottom.
  • Select the elements, attributes, or name spaces of interest and press the Delete key.
    Note: Deleting an element will also delete its children, if any.
Adjust the order of one or more elements In the Linker Target area, select the element(s) of interest and click the and buttons.
Set a static value for an element/attribute/name space In the Linker Target area, right-click the element/attribute/name space of interest and select Set A Fix Value from the contextual menu.
Note:
  • The value you set will replace any value retrieved for the corresponding column from the incoming data flow in your Job.
  • You can set a static value for a child element of the loop element only, on the condition that the element does not have its own children and does not have a source-target mapping on it.
Create a source-target mapping Select the column of interest in the Linker Source area, drop it onto the node of interest in the Linker Target area, and select Create as sub-element of target node, Create as attribute of target node, or Add linker to target node according to your need in the dialog box that appears, and click OK.

If you choose an option that is not permitted for the target node, you will see a warning message and your operation will fail.

Remove a source-target mapping In the Linker Target area, right-click the node of interest and select Disconnect Linker from the contextual menu.
Create a JSON tree from another JSON file Right-click any schema item in the Linker Target area and select Import JSON Tree from the contextual menu to load another JSON file. Then, you need to create source-target mappings manually and define the output schema all again.
Note:

You can select and drop several fields at a time, using the Ctrl + Shift technique to make multiple selections, therefore making mapping faster. You can also make multiple selections for right-click operations.

Procedure

  1. In the Linker Target area, right-click the element you want to set as the loop element and select Set As Loop Element from the contextual menu.
    In this example, define a loop to run on the details element.
  2. Customize the mappings if needed.
  3. Click Next to finalize the schema.