# Moving whole object one level up

**URL:** <https://discourse.nodered.org/t/moving-whole-object-one-level-up/46783>\
**Category:** General\
**Created:** [6 June 2021 18:09 UTC](https://discourse.nodered.org/t/moving-whole-object-one-level-up/46783 "2021-06-06T18:09:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![maraguma](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/maraguma/32/42793_2.png) [@maraguma](https://discourse.nodered.org/u/maraguma)\
**Post date:** [6 June 2021 18:09 UTC](https://discourse.nodered.org/t/moving-whole-object-one-level-up/46783/1 "2021-06-06T18:09:25Z")

</div>

Hi, for a simulation I would like to move a JSON output one level up. I found a similar topic in this forum, but I would like to have it the other way around ([here](https://discourse.nodered.org/t/moving-whole-object-one-level-down/36030)). I would like everything in msg.payload to be moved directly to msg. I'm not even sure if this is possible somehow?

Here's my flow:

```auto
[{"id":"b14b4779.fc7528","type":"inject","z":"f626dd95.85821","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"topic\":\"0/5/10\",\"payload\":true,\"devicename\":\"Doorbell\",\"payloadmeasureunit\":\"unknown\",\"payloadsubtypevalue\":\"On\",\"knx\":{\"event\":\"GroupValue_Write\",\"dpt\":\"1.001\",\"dptdesc\":\"Switch\",\"source\":\"1.0.10\",\"destination\":\"0/5/10\",\"rawValue\":[1]},\"previouspayload\":\"\"}","payloadType":"str","x":230,"y":1280,"wires":[["1c8ee81f.7b23d8"]]},{"id":"1c8ee81f.7b23d8","type":"json","z":"f626dd95.85821","name":"","property":"payload","action":"","pretty":true,"x":350,"y":1280,"wires":[["1eb0fd67.cb58c3"]]},{"id":"1eb0fd67.cb58c3","type":"debug","z":"f626dd95.85821","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":490,"y":1280,"wires":[]}]

```

Maybe someone has a simple idea and could help me.

thanks!

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [6 June 2021 18:13 UTC](https://discourse.nodered.org/t/moving-whole-object-one-level-up/46783/2 "2021-06-06T18:13:17Z")

</div>

```auto
[{"id":"b14b4779.fc7528","type":"inject","z":"c74669a0.6a34f8","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"topic\":\"0/5/10\",\"payload\":true,\"devicename\":\"Doorbell\",\"payloadmeasureunit\":\"unknown\",\"payloadsubtypevalue\":\"On\",\"knx\":{\"event\":\"GroupValue_Write\",\"dpt\":\"1.001\",\"dptdesc\":\"Switch\",\"source\":\"1.0.10\",\"destination\":\"0/5/10\",\"rawValue\":[1]},\"previouspayload\":\"\"}","payloadType":"json","x":310,"y":3280,"wires":[["f4dd5962.6e12d8"]]},{"id":"f4dd5962.6e12d8","type":"function","z":"c74669a0.6a34f8","name":"","func":"msg = msg.payload\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":460,"y":3280,"wires":[["1eb0fd67.cb58c3"]]},{"id":"1eb0fd67.cb58c3","type":"debug","z":"c74669a0.6a34f8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":750,"y":3260,"wires":[]}]

```

just use a function node and set msg=msg.payload;

---

<div class="post-metadata">

**Author:** ![maraguma](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/maraguma/32/42793_2.png) [@maraguma](https://discourse.nodered.org/u/maraguma)\
**Post date:** [6 June 2021 18:56 UTC](https://discourse.nodered.org/t/moving-whole-object-one-level-up/46783/3 "2021-06-06T18:56:17Z")

</div>

thanks, that did the trick. I didn't expect it to be that easy.

---

<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:** [20 June 2021 18:57 UTC](https://discourse.nodered.org/t/moving-whole-object-one-level-up/46783/4 "2021-06-20T18:57:14Z")

</div>

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