tExtractJSONField 来自 tFileInputJSON - Talent Open Studio

tExtractJSONField From tFileInputJSON - Talent Open Studio

我是 Talend Open Studio for DI 的新手。我正在尝试从下面的 JSON 文件中读取数据:

{
"data": [
  {
     "id": "X999_Y999",
     "from": {
        "name": "Tom Brady", "id": "X12"
     },
     "message": "Looking forward to 2010!",
     "actions": [
        {
           "name": "Comment",
           "link": "http://www.facebook.com/X999/posts/Y999"
        },
        {
           "name": "Like",
           "link": "http://www.facebook.com/X999/posts/Y999"
        }
     ],
     "type": "status",
     "created_time": "2010-08-02T21:27:44+0000",
     "updated_time": "2010-08-02T21:27:44+0000"
  },
  {
     "id": "X998_Y998",
     "from": {
        "name": "Peyton Manning", "id": "X18"
     },
     "message": "Where's my contract?",
     "actions": [
        {
           "name": "Comment",
           "link": "http://www.facebook.com/X998/posts/Y998"
        },
        {
           "name": "Like",
           "link": "http://www.facebook.com/X998/posts/Y998"
        }
     ],
     "type": "status",
     "created_time": "2010-08-02T21:27:44+0000",
     "updated_time": "2010-08-02T21:27:44+0000"
   }
 ]
}

我想将三个属性加载到我的 table(id、actions_name 和 actions_link)中。因此,在第一步 (tFileInputJSON) - 我尝试执行如下循环 Json 查询:

在这里,我可以根据需要提取行。但是,然后我使用 tExtractJSONField 使用 XPath 表达式为每个“id”提取“actions”下的各个字段,如下所示:

我尝试了其他几种方法来提取字段,但无法做到这一点。此外,无法在堆栈溢出和人才论坛中找到与我的问题非常相关的任何正确 post。有人可以帮忙吗?

像这样安排工作,

tFileInputJSON 就像,

tExtractJSONFields 就像,

然后你会得到输出,