# Get value from JSON object and send to base64 node

**URL:** https://discourse.nodered.org/t/get-value-from-json-object-and-send-to-base64-node/6963
**Category:** General
**Created:** [18 January 2019 12:48 UTC](https://discourse.nodered.org/t/get-value-from-json-object-and-send-to-base64-node/6963 "2019-01-18T12:48:54Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![Andrei](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/andrei/32/10446_2.png) [@Andrei](https://discourse.nodered.org/u/Andrei)
#### Post date: [18 January 2019 13:44 UTC](https://discourse.nodered.org/t/get-value-from-json-object-and-send-to-base64-node/6963/4 "2019-01-18T13:44:35Z")

</div>

> [@alanca](#):
>
> how do I extract 'payload\_raw' from the json node, and send it to the base64 node, and how do I retain the timestamp until the very end of the flow? In other words, what code do I use in my empty 'parse' function node?

Well, ukmoose already explained how to ensure you extract the correct data from the json. Based on the picture you posted I presume that the properties you need to extract are: `msg.payload_raw` and `msg.metadata.time`.

I created a small flow to fake your data, extract the interesting information from the JSON data and decode the base64 to hex.

[Good reference](https://discourse.nodered.org/t/adding-npm-module-and-using-it/6655/6) on how to decode base64 the simple way without using a contrib node (tks shrickus).`

If it works for you then it is missing only to handle the time information.

 ![r-01](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/b/b3efcba12bb97735d2c5edd2303a38c81f72d41a.png)

Flow:

```auto
[{"id":"d140ec3e.aed54","type":"tab","label":"Flow 3","disabled":false,"info":""},{"id":"180b562c.4ffb3a","type":"inject","z":"d140ec3e.aed54","name":"{ }","topic":"","payload":"{}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":180,"wires":[["196e91a1.312f8e"]]},{"id":"196e91a1.312f8e","type":"change","z":"d140ec3e.aed54","name":"Fake Dataset","rules":[{"t":"set","p":"payload_raw","pt":"msg","to":"/8BEhEP7Q7REQkUSQ5NEIUNDQspEZA==","tot":"str"},{"t":"set","p":"metadata.time","pt":"msg","to":"$now()","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":250,"y":180,"wires":[["5b344ff2.10fdd"]]},{"id":"5b344ff2.10fdd","type":"function","z":"d140ec3e.aed54","name":"Decode Base64","func":"let encoded = msg.payload_raw;\n//encoded = Buffer.from(msg.payload).toString(\"base64\");\n\nmsg.decoded = Buffer.from(encoded, \"base64\");\n\n\nreturn msg;","outputs":1,"noerr":0,"x":480,"y":180,"wires":[["723343de.fbb5bc"]]},{"id":"723343de.fbb5bc","type":"debug","z":"d140ec3e.aed54","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":650,"y":180,"wires":[]}]

```

---

_[View the full topic](https://discourse.nodered.org/t/get-value-from-json-object-and-send-to-base64-node/6963)._
