How do I change a JSON Object Key

#1

Hi everyone,

I am fairly new to Node-Red and am trying to change JSON Object keys.

I have two GPS Trackers that output their tracking data as per the msg.payloads below.

13%20PM

I will need to change the JSON Object keys of latitudeDeg and longitudeDeg to latitude and longitude and have tried with a Change node, below, with no success. Am I using the proper syntax/method?

23%20PM

Thank you for your help!!

0 Likes

#2

Just set new properties to the existing ones.

Set :: msg.payload.latitude :: to :: msg.payload.latitudeDeg

and so on.

0 Likes

#3

Set will copy them
So maybe use move instead ?

1 Like