Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]
Created 03-09-2022 12:48 AM
未处理的表格:
{
"日期":"2022-09-03 19:23:53",
“设备名称”:“032-013”,
"device_id":"1144",
“传感器”:[
{
"sensor_id":"5836",
“价值”:“1”,
“传感器名称”:“设备状态”
},
{
"sensor_id":"5842",
“价值”:””,
“传感器名称”:“12345”
}
…
],
“状态”:“1”
}
最后结果:
{
“日期” :“2022-09-03 19:23:53” ,
“设备名称” :“032-013” ,
“device_id” :“1144” ,
“sensor_id” :“5836” ,
“价值” :“1” ,
“传感器名称” :“设备状态” ,
“状态” :“1”
}
{
“日期” :“2022-09-03 19:23:53” ,
“设备名称” :“032-013” ,
“device_id” :“1144” ,
“sensor_id” :“58 42 ” ,
“价值” :“1” ,
“传感器名称” :“ 12345 ” ,
“状态” :“1”
}
我已经使用 splitjson 将传感器环出,Device_id 和 device_name 也可以通过 EvaluateJsonPath 获得。
但是现在我不知道如何聚合来自两个处理器的数据?
Created 03-09-2022 03:03 AM
@m_hsn ,
You can use the JoltTransformJSON processor to flatten this JSON structure, using the following JOLT specification:
[
{
"operation": "shift",
"spec": {
"sensor": {
"*": {
"*": "[&1].&",
"@(2,date)": "[&1].date",
"@(2,device_name)": "[&1].device_name",
"@(2,device_id)": "[&1].device_id",
"@(2,status)": "[&1].status"
}
}
}
}
]
Cheers,
André
--
Was your question answered? Please take some time to click on "Accept as Solution" below this post.
If you find a reply useful, say thanks by clicking on the thumbs up button.
Created 03-09-2022 03:03 AM
@m_hsn ,
You can use the JoltTransformJSON processor to flatten this JSON structure, using the following JOLT specification:
[
{
"operation": "shift",
"spec": {
"sensor": {
"*": {
"*": "[&1].&",
"@(2,date)": "[&1].date",
"@(2,device_name)": "[&1].device_name",
"@(2,device_id)": "[&1].device_id",
"@(2,status)": "[&1].status"
}
}
}
}
]
Cheers,
André
--
Was your question answered? Please take some time to click on "Accept as Solution" below this post.
If you find a reply useful, say thanks by clicking on the thumbs up button.
Created 03-09-2022 05:58 PM
thanks a lot