【发布时间】:2015-05-08 09:33:11
【问题描述】:
我知道this question,但我不认为标准组件没有解决方案。我正在使用 Talend ESB Studio 5.4。
我必须将来自 REST Web 服务的 JSON 字符串解析为多个输出,并将它们添加到数据库中。
数据库有两个表:
- 用户(user_id、姓名、卡、card_id、积分)
- 操作(user_id、action_id、描述、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!有什么建议吗?
【问题讨论】:
-
为什么要对非平面文件进行平面化?当您创建新的 json 文件时,向导会为您检索架构。
-
所以我需要保存 json 文件并重新加载它吗?