Rename key based on a value

I'm probably missing something simple, but it's driving me crazy so I figure I'd ask in here. I want to change the key of an object property to match a value of a property contained within it. Can anyone recommend a track to start investigating?


I would like the object currently existing as OBX.4 to be OBX.1 (based on OBX.4.setID).

Challenge I'm facing: The messages I'm parsing very greatly in how many OBX rows are present.

You cannot change the key name AFAIK. But you can add a new key.

OBX[OBX.4.setID] = OBX.4

Or something like that, sorry, not tried that code. You could then delete OBX.4

1 Like

I ended up pulling it off by copying the setID field to its own object, passing to a split node, then using a join node to join to a key value pair using the new setID object as the key. Oddly, I was getting extra payloadless messages even though the split node should (to my understanding) only care about msg.payload. I got around this (possible bug?) by using a pair of JSON nodes to "clean" my msg.payload.