2017-06-02 47 views
0

我是Talend Open Studio for DI的新手。我想從下面的JSON文件中讀取數據:tExtractJSONField來自tFileInputJSON - Talent Open Studio

{ 
"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" 
    } 
] 
} 

我想三個屬性加載到我的表(ID,actions_name和actions_link)。因此,在第一個步驟(tFileInputJSON) - 我想下面做一個循環的Json查詢:

enter image description here

在這裏,我能夠爲我需要提取行。但是,然後我使用tExtractJSONField爲每個「id」使用XPath表達式提取單個字段,如下所示: enter image description here

我嘗試了其他幾種方法來提取字段,但無法執行此操作。此外,無法找到任何正確的帖子在堆棧溢出和人才論壇非常相關的我的問題。有人可以幫忙嗎?

回答

1

安排工作怎麼樣, ​​

tFileInputJSON是什麼樣子,

enter image description here

tExtractJSONFields是什麼樣子,

enter image description here

然後你會得到輸出,enter image description here

相關問題