Sample Payload Parser Code (MQTT)
Someone here could you please help me with a sample of payload parser code to extract the value (marked in blue) and put it in the yellow marked variables? The code needs also handle with different topics (e.g. "topic": "unit/bra", "topic": "unit/arg" etc). In the samples available, I didn't find any case similar to this one, and I believe that it can also help other Tago.IO users trying some projects.
{
"topic": "unit/bra",
"payload":
"[
{
\"bn\": \"id1\",
\"bt\": 123456
},
{
\"n\": \"temp1\",
\"u\": \"Cel\",
\"v\": 28.53000000000003
},
{
\"n\": \"hum1\",
\"u\": \"%RH\",
\"v\": 42.700000000000003
},
{
\"n\": \"temp2\",
\"u\": \"Cel\",
\"v\": 3.6200000000000045
},
]"
}