alteryx - 拆分 JSON 输入并在 Alteryx 工作流中应用与列名相同的 JSON 字段名称
问题描述
我正在使用 Alteryx 2019.3 并希望构建一个使用 JSON 作为输入的工作流。当它读取 JSON 时,它会将 JSON 键值对放入名为 JSON_Name 和 JSON_ValueString 的列中
在我模拟的示例中,下面 JSON 中的字段名称在 JSON_Name 列中如下所示:
customer.0.name
customer.0.contactDetails.0.company
customer.0.contactDetails.0.addressDetails.0.address
customer.0.contactDetails.0.addressDetails.0.addressType
customer.0.departments.0.name
我想要做的是把它分成不同的表,并将 JSON_Name 值的最后一部分作为列名,所以它看起来像这样(大写显示表名):
CUSTOMER
customerId
CONTACTDETAILS
customerId
company
ADDRESSDETAILS
customerId
address
addressType
DEPARTMENTS
customerId
name
我如何在 Alteryx 中执行此操作,以及当我在 JSON 列表中可以有多个条目时如何让它工作?
谢谢你的帮助
JSON 输入(例如模拟)
{
"id": "1234",
"contactDetails": [{
"company": "company1",
"addressDetails":
[{
"address": "City1",
"addressType": "Business"
}]
}]
"departments":
[{
"name": "dept1
}]
}
解决方案
您可以使用 Text to columns 执行此操作,然后使用一系列过滤器将其拆分为不同的数据集(表)。您可能希望使用交叉表来获得正确的表格格式。
推荐阅读
- ionic-framework - 我的 `Buttonhandler` 总是导致这个错误,我不知道如何解决它
- ios - 如何使用 openCV 获取 iPhone 的屏幕尺寸?
- hbase - Hbase 集群复制 | 跨集群监控复制延迟
- azure - 不使用 SendGrid 和 Office 365 从 Azure Function App 发送电子邮件
- xml - 有没有办法转换多个数字 xml 值并传递总和?
- office-js - 在发送时检索已发送的电子邮件 ID
- java - Java并发-避免并发修改具有相同ID的对象的数据结构
- c# - 如何根据视图模型中的用户选择绑定不同的用户控件
- ansible - Ansible Python 解释器问题
- java - 如何使用 Spring Data JPA 按日期和时间进行搜索?