Configuring the components
Procedure
-
Double-click the tFileInputJSON component to
open its Basic settings view.
- Select JsonPath without loop from the Read By drop-down list. Then select the Use Url check box and in the URL field displayed enter the URL of the file facebook.json from which the data will be retrieved. In this example, it is http://localhost:8080/docs/facebook.json.
-
Click the [...] button
next to Edit schema and in the Schema dialog box define the schema by adding one
column friends of String type.
Click OK to close the dialog box and accept the propogation prompted by the pop-up dialog box.
- In the Mapping table, enter the JSONPath query "$.user.friends[*]" next to the friends column to retrieve the entire friends node from the source file.
-
Double-click tExtractJSONFields to open its
Basic settings view.
- Select Xpath from the Read By drop-down list.
- In the Loop XPath query field, enter the XPath expression between double quotation marks to specify the node on which the loop is based. In this example, it is "/likes/data".
-
Click the [...] button
next to Edit schema and in the Schema dialog box define the schema by adding five
columns of String type,
id, name,
like_id, like_name, and
like_category, which will hold the data of relevant nodes under the JSON field
friends.
Click OK to close the dialog box and accept the propogation prompted by the pop-up dialog box.
-
In the XPath query
fields of the Mapping table, type in the
XPath query expressions between double quotation marks to specify the JSON nodes
that hold the desired data. In this example:
-
"../../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.
-
-
Double-click the second tLogRow component to
open its Basic settings view.
In the Mode area, select Table (print values in cells of a table) for better readability of the result.
Did this page help you?
If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!