MQTT DAT using JSON messages - not working

We are getting JSON strings via MTQQ and want to parse them into a DAT.

Right now in the MQTT callback we getting the message string, parsing it with TDJSON using textToJSON() and jsonToDat() writing to a table DAT.

The table ‘{ “A”:1, “B”:2}’ ends up being 1 row 4 columns looking as follows
1: {
2: “A”:1
3: “B”:2
4: }

rather than the expected 2 rows 2 columns with the key,value pairs:
key value
1: A 1
2: B 2

Any suggestions, code samples or tips?

Thanks

I’d skip the TDJSON module…

structure = {'A':1, 'B':2}

op('table_json').clear()
[op('table_json').appendRow([key, val]) for key, val in structure.items()]

thanks! all working
attached .tox
MQTTdata.tox (2.47 KB)