kaareseras / node-red-contrib-kusto

Custom Node-Red node to inject data in Kusto (Azure Data Explorer)
MIT License
3 stars 1 forks source link

Additon documentation: split payload in seperate columns #1

Closed frankvandenhurk closed 2 years ago

frankvandenhurk commented 2 years ago

Tnx for the nice work, I really love this functionality.

Maybe it is trival for most people but it took me some time to figure it out. With ,{"column":"part_of_payload","path":"$.payload.key_in_payload"} you can extact a part of the json payload and put it in a seperate column.

Example (I send KNX messages via MQTT and use node-red to store them in Azure):

//Create table
.create table ['knx'] (timestamp: datetime, topic: dynamic, GA: dynamic, val: decimal, knx_textual: dynamic, knx_src_addr: dynamic, knx_dpt: dynamic, payload: dynamic)
//Create JSON mapping
.create table ['knx'] ingestion json mapping 'nodered_json_mapping' '[{"column":"timestamp","path":"$.timestamp"},{"column":"topic","path":"$.topic"},{"column":"GA","path":"$.payload.GA"},{"column":"val","path":"$.payload.val"},{"column":"knx_textual","path":"$.payload.knx_textual"},{"column":"knx_src_addr","path":"$.payload.knx_src_addr"},{"column":"knx_dpt","path":"$.payload.knx_dpt"},{"column":"payload","path":"$.payload"}]'
kaareseras commented 2 years ago

Thank you, Ill add this to the documentation

kaareseras commented 2 years ago

Example aded in documentation