Add dynamic key value in templates

@RobLauer @tjvantoll

Will it possible to mention dynamic key value in the templates?
JAddNumberToObject(bodyAlert, “SensorName”, 12.1);

I have to mention all sensorNames in templates and it is wasting a lot of memory and sending the zero values for other sensors even they are not sending any data.

Example:
JAddNumberToObject(bodyAlert, “SensorName1”, 12.1);
JAddNumberToObject(bodyAlert, “SensorName2”, 12.1);
JAddNumberToObject(bodyAlert, “SensorName3”, 12.1);
JAddNumberToObject(bodyAlert, “SensorName4”, 12.1);

In real-time scenario, I will send one sensorID at a time.

Hey @Srihari,

There is no way to provide dynamic key values.

If you’re only sending one sensor at a time, why not just just include the sensor number as an int?

JAddNumberToObject(bodyAlert, "sensor", 11);
JAddNumberToObject(bodyAlert, "value", 12.1);

{"sensor":1,"value":123.456}
{"sensor":2,"value":78.9}
...etc

TJ