Hi I have a solar data input that gives me a JSON. I need to convert it to line protocol.
Input:
{"forecasts":[{"pv_estimate":2.986,"pv_estimate10":2.923,"pv_estimate90":2.986,"period_end":"2022-04-17T09:00:00.0000000Z","period":"PT30M"},{"pv_estimate":3.2842,"pv_estimate10":3.1522,"pv_estimate90":3.2842,"period_end":"2022-04-17T09:30:00.0000000Z","period":"PT30M"}, ... ]}
Output:
sunhours,source=solcast pv_estimate=2.986,pv_estimate10=2.923,pv_estimate90=2.986 1650186000000
sunhours,source=solcast pv_estimate=3.2842,pv_estimate10=3.1522,pv_estimate90=3.2842 1650186000000
...
Struggling to get started to load the json into an array. I usually use other tools for this so relatively now to the node-red syntax/nodes.
Also tried to look at JSONATA - if easier changing to a different json format is an option:
{
"measurement": "sunhours",
"tags": {
"source": "solcast"
},
"fields": {
"pv_estimate": 2.986,
"pv_estimate10": 2.923,
"pv_estimate90": "2.986 "
},
"timestamp": 1650186000000
}
...