Back

Topic

[KB1152]MQTT parsing JSON key with “.”

Tags: MQTT, SV Manager Toolkit, Svmgr

3 years ago
By FABO
Options
Print
Applies to:

PcVue 15 onwards


Summary:

This article will show you how to successfully read MQTT payloads containing “.” in JSON keywords.


Details:

Let’s imagine a simple situation. PcVue receives values like temperature in an MQTT topic. The device sends a value in the dev.temperature JSON key of an MQTT topic.

Here is an example JSON:

{
    “eui”: “18-B2-20-00-02-27”,
    “dev.temperature”: 28.5,
    “test”:”test”,
    “device_type”:”Temp”
}

 MQTT JSON Dot Explorer

Use a ‘[‘x.y’]’ format to extract data when the keyword contains a character such as the dot: “.”.

The use of ‘ or ” is accepted.

Following the sample, the following format should be used: JsonGetValue(value,'[‘dev.temperature’]’) 

MQTT JSON Dot

 

MQTT JSON Dot Result

 


 


Created on: 03 May 2022 Last update: 30 May 2024