# Keeping original payload data while editing it

**URL:** <https://discourse.nodered.org/t/keeping-original-payload-data-while-editing-it/94557>\
**Category:** General\
**Tags:** http-in\
**Created:** [12 January 2025 17:11 UTC](https://discourse.nodered.org/t/keeping-original-payload-data-while-editing-it/94557 "2025-01-12T17:11:32Z")\
**Posts on this page:** 1\
**Showing post:** 15

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [12 January 2025 17:54 UTC](https://discourse.nodered.org/t/keeping-original-payload-data-while-editing-it/94557/15 "2025-01-12T17:54:30Z")

</div>

Ok...

You're referring to `HTTP Request` (that is a Node) - hence my confusion 🤪  
(but I didn't have a look at the flow to be fair - so that is on me)

Directly after the `HTTP IN` node

- Use a `change` node to store `msg.payload` in `msg.original` (use **deep** clone)
- After you make changes to `payload` (for the client)
  - Respond (to client)

- Then to store the original incoming data, and response to a file (after you respond)
- use something like below

```auto
const Log = {
  request: msg.original,
  response: msg.payload
}

return {payload:JSON.stringify(Log)}

```

Send the above `function` to the file wrote node?

Insurance: I still may have this wrong

---

_[View the full topic](https://discourse.nodered.org/t/keeping-original-payload-data-while-editing-it/94557)._
