# Reading contents of txt file into object

**URL:** <https://discourse.nodered.org/t/reading-contents-of-txt-file-into-object/91157>\
**Category:** General\
**Created:** [21 September 2024 06:02 UTC](https://discourse.nodered.org/t/reading-contents-of-txt-file-into-object/91157 "2024-09-21T06:02:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sirhc](https://avatars.discourse-cdn.com/v4/letter/s/b77776/32.png) [@Sirhc](https://discourse.nodered.org/u/Sirhc)\
**Post date:** [21 September 2024 06:02 UTC](https://discourse.nodered.org/t/reading-contents-of-txt-file-into-object/91157/1 "2024-09-21T06:02:06Z")

</div>

hello

I have a payload which has consists of:  
payload.value1 = abc;  
payload.value2 = def;  
payload.value3= hij;

I write this to a text file, the text file contains:  
{"value1":"abc", "value2":"def","value3":"hij"}

I then use a read node to read the text file. I would like the read node to output in the same format as the original payload, but instead with a debug node I just get a string containing "{"value1":"abc", "value2":"def","value3":"hij"}".

How do I make the read node output the contents in the text file into an object format like how I originally stored it?

---

<div class="post-metadata">

**Author:** ![Sirhc](https://avatars.discourse-cdn.com/v4/letter/s/b77776/32.png) [@Sirhc](https://discourse.nodered.org/u/Sirhc)\
**Post date:** [21 September 2024 06:13 UTC](https://discourse.nodered.org/t/reading-contents-of-txt-file-into-object/91157/2 "2024-09-21T06:13:04Z")

</div>

Figured it out if anyone is interested - you can use the json node

---

<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:** [5 October 2024 06:14 UTC](https://discourse.nodered.org/t/reading-contents-of-txt-file-into-object/91157/3 "2024-10-05T06:14:01Z")

</div>

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