Skip to main content Skip to complementary content
Close announcements banner

Configuring the components

Procedure

  1. Double-click tFileInputJSON to display its Basic settings view.
  2. Click Edit schema to open the schema editor.
    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:
    { "user": { "id": "9999912398",
                "name": "Kelly Clarkson",
                "friends": [
                     { "name": "Tom Cruise",
                       "id": "55555555555555",
                       "likes": {
                           "data": [
                                { "category": "Movie",
                                  "name": "The Shawshank Redemption",
                                  "id": "103636093053996",
                                  "created_time": "2012-11-20T15:52:07+0000"
                                },
                                { "category": "Community",
                                  "name": "Positiveretribution",
                                  "id": "471389562899413",
                                  "created_time": "2012-12-16T21:13:26+0000"
                                }
                                    ]
                                }
                     },
                     { "name": "Tom Hanks",
                       "id": "88888888888888"
                       "likes": {
                            "data": [
                                { "category": "Journalist",
                                  "name": "Janelle Wang",
                                  "id": "136009823148851",
                                  "created_time": "2013-01-01T08:22:17+0000"
                                },
                                { "category": "Tv show",
                                  "name": "Now With Alex Wagner",
                                  "id": "305948749433410",
                                  "created_time": "2012-11-20T06:14:10+0000"
                                }
                                ]
                               }
                      }
                            ]
              }
    }
    
  4. Select JsonPath without loop from the Read By drop-down list.
  5. Enter "$.user.friends[*]" in the JSONPath query column next to the friends column in the Mapping table.

    The JSONPath query entered in this table retrieves the entire friends nodes from the source file.

  6. Double-click tExtractJSONFields to display its Basic settings view.
  7. Click Edit schema to open the schema editor.
  8. 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.
  9. In the pop-up Propagate box, click Yes to propagate the schema to the subsequent components.
  10. Enter "/likes/data" in the Loop XPath query field.
  11. 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.
  12. 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.
  13. Double-click tLogRow to display its Basic settings view.
  14. Select Table (print values in cells of a table) for a better display of the results.

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 – let us know how we can improve!