July 30, 2023

tExtractJSONFields – Docs for ESB 7.x

tExtractJSONFields

Extracts the desired data from JSON fields based on the JSONPath or XPath
query.

Depending on the Talend
product you are using, this component can be used in one, some or all of the following
Job frameworks:

tExtractJSONFields Standard properties

These properties are used to configure tExtractJSONFields running in the Standard Job framework.

The Standard
tExtractJSONFields component belongs to the Processing family.

The component in this framework is available in all Talend
products
.

Basic settings

Property type

Either Built-In or Repository.

 

Built-In: No property data stored centrally.

 

Repository: Select the repository file where the
properties are stored.

Schema and Edit schema

A schema is a row description. It defines the number of fields
(columns) to be processed and passed on to the next component. When you create a Spark
Job, avoid the reserved word line when naming the
fields.

  • Built-In: You create and store the schema locally for this component
    only.

  • Repository: You have already created the schema and stored it in the
    Repository. You can reuse it in various projects and Job designs.

Click Edit
schema
to make changes to the schema.

Note: If you
make changes, the schema automatically becomes built-in.
  • View schema: choose this
    option to view the schema only.

  • Change to built-in property:
    choose this option to change the schema to Built-in for local changes.

  • Update repository connection:
    choose this option to change the schema stored in the repository and decide whether
    to propagate the changes to all the Jobs upon completion. If you just want to
    propagate the changes to the current Job, you can select No upon completion and choose this schema metadata
    again in the Repository Content
    window.

Read By

Select a way of extracting JSON data in the
file.

  • JsonPath: Extracts JSON data based on the
    JSONPath query. With this option selected, you need to select a
    JSONPath API version from the API version
    drop-down list. It is recommended to read data by JSONPath in order
    to gain better performance.

  • Xpath: Extracts JSON data based on the XPath
    query.

JSON field

List of the JSON fields to be extracted.

Loop Jasonpath query

Enter the path pointing to the node within the JSON field, on which the loop is
based.

Note if you have selected Xpath from the Read
by
drop-down list, the Loop Xpath
query
field is displayed instead.

Mapping

Complete this table to map the columns defined in the schema to the
corresponding JSON nodes.

  • Column: The Column cells are automatically filled with the defined schema
    column names.

  • Json query/JSONPath query: Specify the JSONPath node that holds the
    desired data. For more information about JSONPath expressions, see http://goessner.net/articles/JsonPath/.

    This column is available only when JsonPath is selected from the Read
    By
    list.

  • XPath query: Specify the XPath node that
    holds the desired data.

    This column is available only when Xpath is selected from the Read
    By
    list.

  • Get Nodes: Select this check box to
    extract the JSON data of all the nodes or select the check box next to a
    specific node to extract the data of that node.

    This column is available only when Xpath is selected from the Read
    By
    list.

  • Is Array: select this check box when the
    JSON field to be extracted is an array instead of an object.

    This column is available only when Xpath is selected from the Read
    By
    list.

Die on error

Select the check box to stop the execution of the Job when an error
occurs.

Clear the check box to skip any rows on error and complete the process for
error-free rows. When errors are skipped, you can collect the rows on error using a Row > Reject link.

Advanced settings

Use the loop node as root

Select this check box to use the loop node as the root for querying the file.

The loop node is set in the Loop Json query text frame
in the Basic Settings view. If this option is checked,
only the child elements of the loop node are available for querying; otherwise,
both the parent elements and the child elements of the loop node can be
queried. You can specify a parent element through JSON path syntax.

This check box is available only when JsonPath is
selected in the Read By drop-down list of the
Basic settings view.

Encoding

Select the encoding from the list or select Custom
and define it manually. This field is compulsory for database data handling. The
supported encodings depend on the JVM that you are using. For more information, see
https://docs.oracle.com.

tStatCatcher Statistics

Select this check box to gather the Job processing metadata at a Job
level as well as at each component level.

Global Variables

NB_LINE

The number of rows processed. This is an After variable and it returns an integer.

ERROR_MESSAGE

The error message generated by the component when an error occurs. This is an After
variable and it returns a string. This variable functions only if the Die on
error
check box is selected.

Usage

Usage rule

This component is an intermediate component. It needs an input and an
output components.

Limitation

Due to license incompatibility, one or more JARs required to use
this component are not provided. You can install the missing JARs for this particular
component by clicking the Install button
on the Component tab view. You can also
find out and add all missing JARs easily on the Modules tab in the
Integration
perspective of your studio. You can find more details about how to install external modules in
Talend Help Center (https://help.talend.com)
.

Retrieving error messages while extracting data from JSON fields

In this scenario, tWriteJSONField wraps the incoming
data into JSON fields, data of which is then extracted by tExtractJSONFields. Meanwhile, the error messages generated due to
extraction failure, which include the concerned JSON fields and errors, are retrieved
via a Row > Reject
link.

Linking the components

  1. Drop the following components from the Palette onto the design workspace: tFixedFlowInput, tWriteJSONField, tExtractJSONFields, and tLogRow (X2). The two tLogRow components are renamed as data_extracted and reject_info.
  2. Link tFixedFlowInput and tWriteJSONField using a Row > Main connection.
  3. Link tWriteJSONField and tExtractJSONFields using a Row > Main connection.
  4. Link tExtractJSONFields and data_extracted using a Row > Main connection.
  5. Link tExtractJSONFields and reject_info using a Row > Reject connection.

    tExtractJSONFields_1.png

Configuring the components

Setting up the tFixedFlowInput

  1. Double-click tFixedFlowInput to display
    its Basic settings view.

    tExtractJSONFields_2.png

  2. Click Edit schema to open the schema
    editor.

    tExtractJSONFields_3.png

    Click the [+] button to add three
    columns, namely firstname, lastname and dept, with the type of string.
    Click OK to close the editor.
  3. Select Use Inline Content and enter the
    data below in the Content box:

Setting up the tWriteJSONField

  1. Click tWriteJSONField to display its
    Basic settings view.

    tExtractJSONFields_4.png

  2. Click Configure JSON Tree to open the XML
    tree editor.

    tExtractJSONFields_5.png

    The schema of tFixedFlowInput appears in
    the Linker source panel.
  3. In the Linker target panel, click the
    default rootTag and type in staff, which is the root node of the JSON field
    to be generated.
  4. Right-click staff and select Add Sub-element from the context menu.
  5. In the pop-up box, enter the sub-node name, namely firstname.

    tExtractJSONFields_6.png

    Repeat the steps to add two more sub-nodes, namely lastname and dept.
  6. Right-click firstname and select
    Set As Loop Element from the context
    menu.
  7. Drop firstname from the Linker source panel to its counterpart in the
    Linker target panel.

    In the pop-up dialog box, select Add linker to
    target node
    .
    tExtractJSONFields_7.png

    Click OK to close the dialog box.
  8. Repeat the steps to link the two other items.

    Click OK to close the XML tree
    editor.
  9. Click Edit schema to open the schema
    editor.

    tExtractJSONFields_8.png

  10. Click the [+] button in the right panel
    to add one column, namely staff, which
    will hold the JSON data generated.

    Click OK to close the editor.

Setting up the tExtractJSONFields

  1. Double-click tExtractJSONFields to
    display its Basic settings view.

    tExtractJSONFields_9.png

  2. Click Edit schema to open the schema
    editor.

    tExtractJSONFields_10.png

  3. Click the [+] button in the right panel
    to add three columns, namely firstname,
    lastname and dept, which will hold the data of their counterpart nodes in
    the JSON field staff.

    Click OK to close the editor.
  4. In the pop-up Propagate box, click
    Yes to propagate the schema to the
    subsequent components.

    tExtractJSONFields_11.png

  5. In the Loop XPath query field, enter
    “/staff”, which is the root node of
    the JSON data.
  6. In the Mapping area, type in the node
    name of the JSON data under the XPath query
    part. The data of those nodes will be extracted and passed to their
    counterpart columns defined in the output schema.
  7. Specifically, define the XPath query “firstname” for the column firstname, “lastname” for
    the column lastname, and “” for the column dept. Note that “” is not
    a valid XPath query and will lead to execution errors.

Setting up the tLogRow components

  1. Double-click data_extracted to display
    its Basic settings view.

    tExtractJSONFields_12.png

  2. Select Table (print values in cells of a
    table)
    for a better display of the results.
  3. Perform the same setup on the other tLogRow component, namely reject_info.

Executing the Job

  1. Press Ctrl + S to save the Job.
  2. Click F6 to execute the Job.

    tExtractJSONFields_13.png

    As shown above, the reject row offers such details as the data extracted,
    the JSON fields whose data is not extracted and the cause of the extraction
    failure.

Collecting data from your favorite online social network

In this scenario, tFileInputJSON retrieves the
friends node from a JSON file that contains the
data of a Facebook user and tExtractJSONFields extracts
the data from the friends node for flat data
output.

Linking the components

  1. Drop the following components from the Palette onto the design workspace: tFileInputJSON, tExtractJSONFields and tLogRow.
  2. Link tFileInputJSON and tExtractJSONFields using a Row > Main connection.
  3. Link tExtractJSONFields and tLogRow using a Row > Main connection.

    tExtractJSONFields_14.png

Configuring the components

  1. Double-click tFileInputJSON to display
    its Basic settings view.

    tExtractJSONFields_15.png

  2. Click Edit schema to open the schema
    editor.

    tExtractJSONFields_16.png

    Click the [+] button to add one column,
    namely friends, of the String
    type.
    Click OK to close the editor.
  3. Click the […] button to browse for the
    JSON file, facebook.json in this
    case:

  4. Clear the Read by XPath check box.

    In the Mapping table, enter the JSONPath
    query “$.user.friends[*]” next to the
    friends column, retrieving the entire
    friends node from the source
    file.
  5. Double-click tExtractJSONFields to
    display its Basic settings view.

    tExtractJSONFields_17.png

  6. Click Edit schema to open the schema
    editor.

    tExtractJSONFields_18.png

  7. Click the [+] button in the right panel
    to add five columns, namely id, name, like_id, like_name and
    like_category, which will hold the
    data of relevant nodes in the JSON field friends.

    Click OK to close the editor.
  8. In the pop-up Propagate box, click
    Yes to propagate the schema to the
    subsequent components.

    tExtractJSONFields_11.png

  9. In the Loop XPath query field, enter
    “/likes/data”.
  10. In the Mapping area, type in the queries
    of the JSON nodes in the XPath query
    column. The data of those nodes will be extracted and passed to their
    counterpart columns defined in the output schema.
  11. Specifically, define the XPath query “../../id” (querying the “/friends/id” node) for the column id, “../../name”
    (querying the “/friends/name” node) for
    the column name, “id” for the column like_id, “name” for the
    column like_name, and “category” for the column like_category.
  12. Double-click tLogRow to display its
    Basic settings view.

    tExtractJSONFields_12.png

  13. Select Table (print values in cells of a
    table)
    for a better display of the results.

Executing the Job

  1. Press Ctrl + S to save the Job.
  2. Click F6 to execute the Job.

    tExtractJSONFields_21.png

    As shown above, the friends data of the Facebook user Kelly Clarkson is
    extracted correctly.

Extracting data from a JSON file through looping

This scenario describes a Job that extracts data from a JSON file through
multiple loops and displays the data on the console.

The following lists the content of the JSON file,
sample.json.

This Job extracts the values of the following elements.

  • Guid
  • TransactionId
  • ProductId
  • Quantity
  • Price
  • Due-Date

Establishing the tExtractJSONFields looping Job

  1. Create a Job and add a tFileInputJSON component, three tExtractJsonFields
    components, and a tLogRow component.
  2. Connect the components using Row > Main connections.

    tExtractJSONFields_22.png

Configuring tExtractJSONFields looping input

This task assumes that you know the structure of the JSON file.

  1. In the Basic settings view
    of the tFileInputJSON component, select
    JsonPath from the Read By drop-down list.

    tExtractJSONFields_23.png

  2. In the filename field, specified the input JSON file,
    sample.json in this example.
  3. In the schema editor, add two columns,
    Guid (type String) and
    Transactions (type Object).

    tExtractJSONFields_24.png

  4. 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.
  5. In the Basic settings view, enter
    "$" in the Loop Json
    query
    text box to loop the elements within the root elements.
  6. In the Json query column of the Mapping table, enter the
    following Json query expressions in double quotation marks.

    • $.Guid to extract the value of the Guid
      element;
    • $.Transactions to extract the content of the
      Transactions element.

Configuring the tExtractJSONFields components for looping

  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
    tExtractJSONFields_25.png

  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
    tExtractJSONFields_26.png

    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.

Setting the display for tExtractJSONFields values

  1. Open the Basic settings view of the
    tLogRow component.

    tExtractJSONFields_27.png

  2. Select the preferred option in the Mode section.

Executing tExtractJSONFields loop Job

  1. Press Ctrl+S to save the Job.
  2. Press F6 to execute the Job.
    The following figure shows the result.

    tExtractJSONFields_28.png

    The values of the Guid element, the TransactionId element, the
    ProductId element, the Quantity element, the Price element, and the Due_date element
    are extracted from the source JSON file and displayed.

tExtractJSONFields MapReduce properties (deprecated)

These properties are used to configure tExtractJSONFields running in the MapReduce Job framework.

The MapReduce
tExtractJSONFields component belongs to the Processing family.

The component in this framework is available in all subscription-based Talend products with Big Data
and Talend Data Fabric.

The MapReduce framework is deprecated from Talend 7.3 onwards. Use Talend Jobs for Apache Spark to accomplish your integration tasks.

Basic settings

Property type

Either Built-In or Repository.

 

Built-In: No property data stored centrally.

 

Repository: Select the repository file where the
properties are stored.

Schema and Edit
Schema

A schema is a row description. It defines the number of fields
(columns) to be processed and passed on to the next component. When you create a Spark
Job, avoid the reserved word line when naming the
fields.

Click Edit
schema
to make changes to the schema. If the current schema is of the Repository type, three options are available:

  • View schema: choose this
    option to view the schema only.

  • Change to built-in property:
    choose this option to change the schema to Built-in for local changes.

  • Update repository connection:
    choose this option to change the schema stored in the repository and decide whether
    to propagate the changes to all the Jobs upon completion. If you just want to
    propagate the changes to the current Job, you can select No upon completion and choose this schema metadata
    again in the Repository Content
    window.

 

Built-In: You create and store the schema locally for this component
only.

 

Repository: You have already created the schema and stored it in the
Repository. You can reuse it in various projects and Job designs.

Read by

Select a way of extracting the JSON data in the file.

  • Xpath: Extracts the JSON data based on
    the XPath query.

  • JsonPath: Extracts the JSON data based on
    the JSONPath query. Note that it is recommended to read the data by JSONPath in
    order to gain better performance.

JSON field

List of the JSON fields to be extracted.

Loop Jasonpath query

Enter the path pointing to the node within the JSON field, on which the loop is
based.

Note if you have selected Xpath from the Read
by
drop-down list, the Loop Xpath
query
field is displayed instead.

Mapping

Complete this table to map the columns defined in the schema to the
corresponding JSON nodes.

  • Column: The Column cells are automatically filled with the defined schema
    column names.

  • Json query/JSONPath query: Specify the JSONPath node that holds the
    desired data. For more information about JSONPath expressions, see http://goessner.net/articles/JsonPath/.

    This column is available only when JsonPath is selected from the Read
    By
    list.

  • XPath query: Specify the XPath node that
    holds the desired data.

    This column is available only when Xpath is selected from the Read
    By
    list.

  • Get Nodes: Select this check box to
    extract the JSON data of all the nodes or select the check box next to a
    specific node to extract the data of that node.

    This column is available only when Xpath is selected from the Read
    By
    list.

  • Is Array: select this check box when the
    JSON field to be extracted is an array instead of an object.

    This column is available only when Xpath is selected from the Read
    By
    list.

Die on error

Select the check box to stop the execution of the Job when an error
occurs.

Clear the check box to skip any rows on error and complete the process for
error-free rows. When errors are skipped, you can collect the rows on error using a Row > Reject link.

Advanced settings

Encoding

Select the encoding from the list or select Custom
and define it manually. This field is compulsory for database data handling. The
supported encodings depend on the JVM that you are using. For more information, see
https://docs.oracle.com.

Global Variables

Global Variables

ERROR_MESSAGE: the error message generated by the
component when an error occurs. This is an After variable and it returns a string. This
variable functions only if the Die on error check box is
cleared, if the component has this check box.

NB_LINE: the number of rows read by an input component or
transferred to an output component. This is an After variable and it returns an
integer.

A Flow variable functions during the execution of a component while an After variable
functions after the execution of the component.

To fill up a field or expression with a variable, press Ctrl +
Space
to access the variable list and choose the variable to use from it.

For further information about variables, see
Talend Studio

User Guide.

Usage

Usage rule

In a
Talend
Map/Reduce Job, this component is used as an intermediate
step and other components used along with it must be Map/Reduce components, too. They
generate native Map/Reduce code that can be executed directly in Hadoop.

You need to use the Hadoop Configuration tab in the
Run view to define the connection to a given Hadoop
distribution for the whole Job.

For further information about a
Talend
Map/Reduce Job, see the sections
describing how to create, convert and configure a
Talend
Map/Reduce Job of the

Talend Open Studio for Big Data Getting Started Guide
.

Note that in this documentation, unless otherwise
explicitly stated, a scenario presents only Standard Jobs,
that is to say traditional
Talend
data integration Jobs, and non Map/Reduce Jobs.

Related scenarios

No scenario is available for the Map/Reduce version of this component yet.

tExtractJSONFields properties for Apache Spark Batch

These properties are used to configure tExtractJSONFields running in the Spark Batch Job framework.

The Spark Batch
tExtractJSONFields component belongs to the Processing family.

The component in this framework is available in all subscription-based Talend products with Big Data
and Talend Data Fabric.

Basic settings

Property type

Either Built-In or Repository.

 

Built-In: No property data stored centrally.

 

Repository: Select the repository file where the
properties are stored.

Schema and Edit
Schema

A schema is a row description. It defines the number of fields
(columns) to be processed and passed on to the next component. When you create a Spark
Job, avoid the reserved word line when naming the
fields.

Click Edit
schema
to make changes to the schema. If the current schema is of the Repository type, three options are available:

  • View schema: choose this
    option to view the schema only.

  • Change to built-in property:
    choose this option to change the schema to Built-in for local changes.

  • Update repository connection:
    choose this option to change the schema stored in the repository and decide whether
    to propagate the changes to all the Jobs upon completion. If you just want to
    propagate the changes to the current Job, you can select No upon completion and choose this schema metadata
    again in the Repository Content
    window.

 

Built-In: You create and store the schema locally for this component
only.

 

Repository: You have already created the schema and stored it in the
Repository. You can reuse it in various projects and Job designs.

Read by

Select a way of extracting the JSON data in the file.

  • Xpath: Extracts the JSON data based on
    the XPath query.

  • JsonPath: Extracts the JSON data based on
    the JSONPath query. Note that it is recommended to read the data by JSONPath in
    order to gain better performance.

JSON field

List of the JSON fields to be extracted.

Loop Jasonpath query

Enter the path pointing to the node within the JSON field, on which the loop is
based.

Note if you have selected Xpath from the Read
by
drop-down list, the Loop Xpath
query
field is displayed instead.

Mapping

Complete this table to map the columns defined in the schema to the
corresponding JSON nodes.

  • Column: The Column cells are automatically filled with the defined schema
    column names.

  • Json query/JSONPath query: Specify the JSONPath node that holds the
    desired data. For more information about JSONPath expressions, see http://goessner.net/articles/JsonPath/.

    This column is available only when JsonPath is selected from the Read
    By
    list.

  • XPath query: Specify the XPath node that
    holds the desired data.

    This column is available only when Xpath is selected from the Read
    By
    list.

  • Get Nodes: Select this check box to
    extract the JSON data of all the nodes or select the check box next to a
    specific node to extract the data of that node.

    This column is available only when Xpath is selected from the Read
    By
    list.

  • Is Array: select this check box when the
    JSON field to be extracted is an array instead of an object.

    This column is available only when Xpath is selected from the Read
    By
    list.

Die on error

Select the check box to stop the execution of the Job when an error
occurs.

Advanced settings

Encoding

Select the encoding from the list or select Custom
and define it manually. This field is compulsory for database data handling. The
supported encodings depend on the JVM that you are using. For more information, see
https://docs.oracle.com.

Usage

Usage rule

This component is used as an intermediate step.

This component, along with the Spark Batch component Palette it belongs to,
appears only when you are creating a Spark Batch Job.

Note that in this documentation, unless otherwise explicitly stated, a
scenario presents only Standard Jobs, that is to
say traditional
Talend
data integration Jobs.

Spark Connection

In the Spark
Configuration
tab in the Run
view, define the connection to a given Spark cluster for the whole Job. In
addition, since the Job expects its dependent jar files for execution, you must
specify the directory in the file system to which these jar files are
transferred so that Spark can access these files:

  • Yarn mode (Yarn client or Yarn cluster):

    • When using Google Dataproc, specify a bucket in the
      Google Storage staging bucket
      field in the Spark configuration
      tab.

    • When using HDInsight, specify the blob to be used for Job
      deployment in the Windows Azure Storage
      configuration
      area in the Spark
      configuration
      tab.

    • When using Altus, specify the S3 bucket or the Azure
      Data Lake Storage for Job deployment in the Spark
      configuration
      tab.
    • When using Qubole, add a
      tS3Configuration to your Job to write
      your actual business data in the S3 system with Qubole. Without
      tS3Configuration, this business data is
      written in the Qubole HDFS system and destroyed once you shut
      down your cluster.
    • When using on-premise
      distributions, use the configuration component corresponding
      to the file system your cluster is using. Typically, this
      system is HDFS and so use tHDFSConfiguration.

  • Standalone mode: use the
    configuration component corresponding to the file system your cluster is
    using, such as tHDFSConfiguration or
    tS3Configuration.

    If you are using Databricks without any configuration component present
    in your Job, your business data is written directly in DBFS (Databricks
    Filesystem).

This connection is effective on a per-Job basis.

Related scenarios

No scenario is available for the Spark Batch version of this component
yet.

tExtractJSONFields properties for Apache Spark Streaming

These properties are used to configure tExtractJSONFields running in the Spark Streaming Job framework.

The Spark Streaming
tExtractJSONFields component belongs to the Processing family.

This component is available in Talend Real Time Big Data Platform and Talend Data Fabric.

Basic settings

Property type

Either Built-In or Repository.

 

Built-In: No property data stored centrally.

 

Repository: Select the repository file where the
properties are stored.

Schema and Edit
Schema

A schema is a row description. It defines the number of fields
(columns) to be processed and passed on to the next component. When you create a Spark
Job, avoid the reserved word line when naming the
fields.

Click Edit
schema
to make changes to the schema. If the current schema is of the Repository type, three options are available:

  • View schema: choose this
    option to view the schema only.

  • Change to built-in property:
    choose this option to change the schema to Built-in for local changes.

  • Update repository connection:
    choose this option to change the schema stored in the repository and decide whether
    to propagate the changes to all the Jobs upon completion. If you just want to
    propagate the changes to the current Job, you can select No upon completion and choose this schema metadata
    again in the Repository Content
    window.

 

Built-In: You create and store the schema locally for this component
only.

 

Repository: You have already created the schema and stored it in the
Repository. You can reuse it in various projects and Job designs.

Read by

Select a way of extracting the JSON data in the file.

  • Xpath: Extracts the JSON data based on
    the XPath query.

  • JsonPath: Extracts the JSON data based on
    the JSONPath query. Note that it is recommended to read the data by JSONPath in
    order to gain better performance.

JSON field

List of the JSON fields to be extracted.

Loop Jasonpath query

Enter the path pointing to the node within the JSON field, on which the loop is
based.

Note if you have selected Xpath from the Read
by
drop-down list, the Loop Xpath
query
field is displayed instead.

Mapping

Complete this table to map the columns defined in the schema to the
corresponding JSON nodes.

  • Column: The Column cells are automatically filled with the defined schema
    column names.

  • Json query/JSONPath query: Specify the JSONPath node that holds the
    desired data. For more information about JSONPath expressions, see http://goessner.net/articles/JsonPath/.

    This column is available only when JsonPath is selected from the Read
    By
    list.

  • XPath query: Specify the XPath node that
    holds the desired data.

    This column is available only when Xpath is selected from the Read
    By
    list.

  • Get Nodes: Select this check box to
    extract the JSON data of all the nodes or select the check box next to a
    specific node to extract the data of that node.

    This column is available only when Xpath is selected from the Read
    By
    list.

  • Is Array: select this check box when the
    JSON field to be extracted is an array instead of an object.

    This column is available only when Xpath is selected from the Read
    By
    list.

Die on error

Select the check box to stop the execution of the Job when an error
occurs.

Advanced settings

Encoding

Select the encoding from the list or select Custom
and define it manually. This field is compulsory for database data handling. The
supported encodings depend on the JVM that you are using. For more information, see
https://docs.oracle.com.

Usage

Usage rule

This component is used as an intermediate step.

This component, along with the Spark Streaming component Palette it belongs to, appears
only when you are creating a Spark Streaming Job.

Note that in this documentation, unless otherwise explicitly stated, a scenario presents
only Standard Jobs, that is to say traditional
Talend
data
integration Jobs.

Spark Connection

In the Spark
Configuration
tab in the Run
view, define the connection to a given Spark cluster for the whole Job. In
addition, since the Job expects its dependent jar files for execution, you must
specify the directory in the file system to which these jar files are
transferred so that Spark can access these files:

  • Yarn mode (Yarn client or Yarn cluster):

    • When using Google Dataproc, specify a bucket in the
      Google Storage staging bucket
      field in the Spark configuration
      tab.

    • When using HDInsight, specify the blob to be used for Job
      deployment in the Windows Azure Storage
      configuration
      area in the Spark
      configuration
      tab.

    • When using Altus, specify the S3 bucket or the Azure
      Data Lake Storage for Job deployment in the Spark
      configuration
      tab.
    • When using Qubole, add a
      tS3Configuration to your Job to write
      your actual business data in the S3 system with Qubole. Without
      tS3Configuration, this business data is
      written in the Qubole HDFS system and destroyed once you shut
      down your cluster.
    • When using on-premise
      distributions, use the configuration component corresponding
      to the file system your cluster is using. Typically, this
      system is HDFS and so use tHDFSConfiguration.

  • Standalone mode: use the
    configuration component corresponding to the file system your cluster is
    using, such as tHDFSConfiguration or
    tS3Configuration.

    If you are using Databricks without any configuration component present
    in your Job, your business data is written directly in DBFS (Databricks
    Filesystem).

This connection is effective on a per-Job basis.

Related scenarios

For a related scenario, see Analyzing a Twitter flow in near real-time.

tExtractJSONFields Storm properties (deprecated)

These properties are used to configure tExtractJSONFields running in the Storm Job framework.

The Storm
tExtractJSONFields component belongs to the Processing family.

This component is available in Talend Real Time Big Data Platform and Talend Data Fabric.

The Storm framework is deprecated from Talend 7.1 onwards. Use Talend Jobs for Apache Spark Streaming to accomplish your Streaming related tasks.

Basic settings

Property type

Either Built-In or Repository.

 

Built-In: No property data stored centrally.

 

Repository: Select the repository file where the
properties are stored.

Schema and Edit
Schema

A schema is a row description. It defines the number of fields
(columns) to be processed and passed on to the next component. When you create a Spark
Job, avoid the reserved word line when naming the
fields.

Click Edit
schema
to make changes to the schema. If the current schema is of the Repository type, three options are available:

  • View schema: choose this
    option to view the schema only.

  • Change to built-in property:
    choose this option to change the schema to Built-in for local changes.

  • Update repository connection:
    choose this option to change the schema stored in the repository and decide whether
    to propagate the changes to all the Jobs upon completion. If you just want to
    propagate the changes to the current Job, you can select No upon completion and choose this schema metadata
    again in the Repository Content
    window.

 

Built-In: You create and store the schema locally for this component
only.

 

Repository: You have already created the schema and stored it in the
Repository. You can reuse it in various projects and Job designs.

JSON field

List of the JSON fields to be extracted.

Loop XPath query

Node within the JSON field, on which the loop is based.

Mapping

Column: schema defined to hold
the data extracted from the JSON field.

XPath Query: XPath Query to specify
the node within the JSON field.

Get nodes: select this check box to
extract the JSON data of all the nodes specified in the XPath query list or select the check box
next to a specific node to extract its JSON data only.

Is Array: select this check box
when the JSON field to be extracted is an array instead of an
object.

Advanced settings

Encoding

Select the encoding from the list or select Custom
and define it manually. This field is compulsory for database data handling. The
supported encodings depend on the JVM that you are using. For more information, see
https://docs.oracle.com.

Usage

Usage rule

If you have subscribed to one of the
Talend
solutions with Big Data, you can also
use this component as a Storm component. In a
Talend
Storm Job, this component is used as
an intermediate step and other components used along with it must be Storm components, too.
They generate native Storm code that can be executed directly in a Storm system.

The Storm version does not support the use of the global variables.

You need to use the Storm Configuration tab in the
Run view to define the connection to a given Storm
system for the whole Job.

This connection is effective on a per-Job basis.

For further information about a
Talend
Storm Job, see the sections
describing how to create and configure a
Talend
Storm Job of the
Talend Open Studio for Big Data Getting Started Guide
.

Note that in this documentation, unless otherwise explicitly stated, a scenario presents
only Standard Jobs, that is to say traditional
Talend
data
integration Jobs.

Related scenarios

No scenario is available for the Storm version of this component
yet.


Document get from Talend https://help.talend.com
Thank you for watching.
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x