Talend:将JSON字符串解析为多个输出

时间:2015-05-08 09:33:11

标签: json talend

我知道this question但我不相信没有标准组件的解决方案。我正在使用Talend ESB Studio 5.4。

我必须将REST Web服务中的JSON字符串解析为多个输出,并将它们添加到数据库中。

数据库有两个表:

  • 用户(user_id,name,card,card_id,points)
  • 操作(user_id,action_id,description,used_point)

我的JSON结构是这样的:

{
    "users": [
        {
            "name": "foo",
            "user_id": 1,
            "card": {
                "card_id": "AAA",
                "points": 10
            },
            "actions": [
                {
                    "action_id": 1,
                    "description": "buy",
                    "used_points": 2
                },
                {
                    "action_id": 3,
                    "description": "buy",
                    "used_points": 1
                }
            ]
        },
        {
            "name": "bar",
            "user_id": 2,
            "card": {
                "card_id": "BBB",
                "points": -1
            },
            "actions": [
                {
                    "id": 2,
                    "description": "sell",
                    "used_point": 5
                }
            ]
        }
    ]
}

我曾尝试添加JSON架构元数据,但我不清楚如何“平放”JSON。我试着看看tXMLMap,tExtractJSONFields ..但直到现在都没有运气。 我也看了一下tJavaRow,但我不明白如何制作一个Schema。

很可惜因为到现在为止我爱Talend!有什么建议吗?

0 个答案:

没有答案
相关问题