Configuring the tExtractJSONFields components for looping - 7.1

JSON

author
Talend Documentation Team
EnrichVersion
7.1
EnrichProdName
Talend Big Data
Talend Big Data Platform
Talend Data Fabric
Talend Data Integration
Talend Data Management Platform
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Open Studio for Big Data
Talend Open Studio for Data Integration
Talend Open Studio for ESB
Talend Open Studio for MDM
Talend Real-Time Big Data Platform
task
Data Governance > Third-party systems > File components (Integration) > JSON components
Data Quality and Preparation > Third-party systems > File components (Integration) > JSON components
Design and Development > Third-party systems > File components (Integration) > JSON components
EnrichPlatform
Talend Studio

Procedure

  1. In the schema editor of the first tExtractJSONFileds component, add the following columns in the output table.
    • Guid, type String;
    • TransactionId, type Integer;
    • Products, type Object
  2. Close the schema editor and click Yes in the subsequent dialog box to propagate the schema to the next component.
    The columns just added appear in the Mapping table of the Basic settings view.
  3. Set the other options in the Basic settings view as follows.
    • JSON field: Transactions;
    • Loop Jsonpath query: "*" (in double quotation marks);
    • Guid: empty, for receiving the Guid value from the previous component;
    • TransactionId: "TransactionId" (in double quotation marks);
    • Products: "Products" (in double quotation marks);
    • Others: unchanged
    The settings loop all the elements within the Transactions element and extract the values of the TransactionId and the Products elements.
  4. In the schema editor of the second tExtractJSONFileds component, add the following columns in the output table.
    • Guid, type String;
    • TransactionId, type Integer;
    • ProductId, type String;
    • Packs, type Object
  5. Close the schema editor and click Yes in the subsequent dialog box to propagate the schema to the next component.
    The columns just added appear in the Mapping table of the Basic settings view.
  6. Set the other options in the Basic settings view as follows.
    • JSON field: Products;
    • Loop Jsonpath query: "*" (in double quotation marks);
    • Guid: empty, for receiving the Guid value from the previous component;
    • TransactionId: empty, for receiving the TransactionId from the previous component;
    • ProductId: "ProductId" (in double quotation marks);
    • Packs: "Packs" (in double quotation marks);
    • Others: unchanged
    The settings in the above figure loop all the elements within the Products element and extract the values of the ProductId and the Packs elements.
  7. In the schema editor of the third tExtractJSONFileds component, add the following columns in the output table.
    • Guid, type String;
    • TransactionId, type Integer;
    • ProductId, type String;
    • Quantity, type Integer;
    • Price, type Float;
    • Due_Date, type Date
  8. Close the schema editor and click Yes in the subsequent dialog box to propagate the schema to the next component.
    The columns just added appear in the Mapping table of the Basic settings view.
  9. Set the other options in the Basic settings view as follows.
    • JSON field: Packs;
    • Loop Jsonpath query: "*" (in double quotation marks);
    • Guid: empty, for receiving the Guid value from the previous component;
    • TransactionId: empty, for receiving the TransactionId value from the previous component;
    • ProductId: empty, for receiving the ProductId value from the previous component;
    • Quantity: "Quantity" (in double quotation marks);
    • Price: "Price" (in double quotation marks);
    • Due_Date: "Due_Date" (in double quotation marks);
    • Others: unchanged
    The settings in the above figure loop all the elements within the Packs element and extract the values of the Quantity, the Price, and the Due_Date elements.