Only print ending

I have a payload sting thats exporting like this. Im wanting to read just the end fields and not all the " { :.

I have tired using the split but I cant seem to get the right function.

node: debug 113
msg.payload : string[51]
"{"INDIANA 2":"INDIANA 2","TK3300KI":"TK3300KI"}"

The result Im looking for is INDIANA 2 and TK3300KI instead of "{"INDIANA 2":"INDIANA 2","TK3300KI":"TK3300KI"}"

At your debug node "debug 104" the payload is an object.
At node "false" msg.detect is an object
And at "debug 113" payload is a string.

In what format does the data arrive in Node-red?

Can you explain why you have a key "INDIANA *2*" rather than (say) "INDIANA"?
Do you have control over the format of this data?

It would be much easier for you if the data arrived in a format like

{
state: "INDIANA",
code: "TK3300KI"
}

If you keep payload as an object, here are two methods that do not use a function node.

[{"id":"0b5d0e8dc1368573","type":"inject","z":"65617ffeb779f51c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"INDIANA 2\":\"INDIANA 2\",\"TK3300KI\":\"TK3300KI\"}","payloadType":"json","x":90,"y":2540,"wires":[["5c49e57a0dbd2aec","230bdbe7d1b651b4"]]},{"id":"5c49e57a0dbd2aec","type":"split","z":"65617ffeb779f51c","name":"","splt":",","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":210,"y":2540,"wires":[["3ba3c6856406b414"]]},{"id":"230bdbe7d1b651b4","type":"csv","z":"65617ffeb779f51c","name":"","sep":",","hdrin":"","hdrout":"none","multi":"one","ret":"\\n","temp":"","skip":"0","strings":true,"include_empty_strings":"","include_null_values":"","x":230,"y":2580,"wires":[["3fc8ab1d7234c172"]]},{"id":"3ba3c6856406b414","type":"change","z":"65617ffeb779f51c","name":"","rules":[{"t":"set","p":"parts.type","pt":"msg","to":"string","tot":"str"},{"t":"set","p":"parts.ch","pt":"msg","to":" and ","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":2540,"wires":[["607a05e9264273bd"]]},{"id":"3fc8ab1d7234c172","type":"change","z":"65617ffeb779f51c","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":",","fromt":"str","to":" and ","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":2600,"wires":[["7f767c0cfe93dc5b"]]},{"id":"607a05e9264273bd","type":"join","z":"65617ffeb779f51c","name":"","mode":"auto","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":"false","timeout":"","count":"","reduceRight":false,"x":550,"y":2540,"wires":[["7f767c0cfe93dc5b"]]},{"id":"7f767c0cfe93dc5b","type":"debug","z":"65617ffeb779f51c","name":"debug 261","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":750,"y":2600,"wires":[]}]

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