# Object manipulation

**URL:** <https://discourse.nodered.org/t/object-manipulation/81422>\
**Category:** General\
**Created:** [18 September 2023 16:34 UTC](https://discourse.nodered.org/t/object-manipulation/81422 "2023-09-18T16:34:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![j.koopmann](https://avatars.discourse-cdn.com/v4/letter/j/85e7bf/32.png) [@j.koopmann](https://discourse.nodered.org/u/j.koopmann)\
**Post date:** [18 September 2023 16:34 UTC](https://discourse.nodered.org/t/object-manipulation/81422/1 "2023-09-18T16:34:14Z")

</div>

This will be a no-brainer for 99% of people but I am lost at the moment. Simple task.

Via MQTT I get messages from a program (p4d). I receive them and have them converted to JSON. All messages have properties:

{"id":"UD:0x01","type":"UD","name":"Heizungsstatus","unit":"zst","state":"off","value":19,"action":"CHANGE"}

I want to store this in Influx with the measurement being "name" (Heizungsstatus) and the value being the value (19). I believe the msg.property I have to feed to influx out is

{"Heizungsstatus","19"}

How do I manipulate the msg properly? And of course I would need this to be dynamic and work with all combinations for name/value. I would love to filter these then later on to only allow certain names/measurements only...

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [18 September 2023 17:21 UTC](https://discourse.nodered.org/t/object-manipulation/81422/2 "2023-09-18T17:21:33Z")

</div>

I guess you mean you want to use the payload `name` as a key and the `value` property as its value?

In a function node:

```auto
msg.payload = {
   [msg.payload.name]: msg.payload.value
}
return msg

```

Possible via change node too with and without JSONata

---

<div class="post-metadata">

**Author:** ![j.koopmann](https://avatars.discourse-cdn.com/v4/letter/j/85e7bf/32.png) [@j.koopmann](https://discourse.nodered.org/u/j.koopmann)\
**Post date:** [18 September 2023 19:05 UTC](https://discourse.nodered.org/t/object-manipulation/81422/3 "2023-09-18T19:05:00Z")

</div>

Sometimes things are so simple. Thanks so much!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [2 October 2023 19:05 UTC](https://discourse.nodered.org/t/object-manipulation/81422/4 "2023-10-02T19:05:47Z")

</div>

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