How to change string text to object

This is the output of my device

But I want to change the result to json object like this

timestamp: "2022-07-04T14:37:01.848Z"
type: "iBeacon"
mac: "AC233FAB83BA"
bleName: ""
ibeaconUuid: "E2C56DB5DFFB48D2B060D0F5A71096E0"
ibeaconMajor: 0
ibeaconMinor: 0
rssi: -20
ibeaconTxPower: -59
battery: 0

Any help would be greatly appreciated :slightly_smiling_face: :slightly_smiling_face:

The text is almost valid JSON, but only as a string (almost as internal quotes would need escaping) . To make it a valid JSON string that represents an object you would need to add { } to beginning and end.

You can do that at source, or as below


This is my source

So where should I edit to get valid JSON
thanks for your help

Source means the tcp device sending data.

please check my example.
copy my example.
Then in flow editor,
press ctrl i
then paste my code and press import.
You will then see a flow example in the editor.

Images have their uses, but no good showing setting, best to export a small example of your issue and paste using </> button in your OG post.

Thanks for your advice
I am new for node-red :smile:
Your solution make it work well.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.