# Capture payload

**URL:** <https://forums.losant.com/t/capture-payload/2778>\
**Category:** Help\
**Tags:** workflow\
**Created:** [April 1, 2020, 7:26pm UTC](https://forums.losant.com/t/capture-payload/2778 "2020-04-01T19:26:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lars\_Andersson](https://avatars.discourse-cdn.com/v4/letter/l/f05b48/32.png) [@Lars\_Andersson](https://forums.losant.com/u/Lars_Andersson)\
**Post date:** [April 1, 2020, 7:26pm UTC](https://forums.losant.com/t/capture-payload/2778/1 "2020-04-01T19:26:20Z")

</div>

How could I capture payloads from a device and save payload as json string to a file?

---

<div class="post-metadata">

**Author:** ![Lars\_Andersson](https://avatars.discourse-cdn.com/v4/letter/l/f05b48/32.png) [@Lars\_Andersson](https://forums.losant.com/u/Lars_Andersson)\
**Post date:** [April 1, 2020, 7:29pm UTC](https://forums.losant.com/t/capture-payload/2778/2 "2020-04-01T19:29:08Z")

</div>

as additional info for the reason of this, is to grab the textual content to use in a data model explaining data flow from some devices.

---

<div class="post-metadata">

**Author:** ![JuliaKempf](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/juliakempf/32/2446_2.png) [@JuliaKempf](https://forums.losant.com/u/JuliaKempf)\
**Post date:** [April 1, 2020, 8:36pm UTC](https://forums.losant.com/t/capture-payload/2778/4 "2020-04-01T20:36:16Z")

</div>

Hi @Lars_Andersson,

Just a couple questions to help me understand your use case. Are the device payloads currently being sent to Losant, and if so, how? Additionally, would the file be saved to [Losant Files](https://docs.losant.com/applications/files/) or elsewhere?

Thanks!  
Julia

---

<div class="post-metadata">

**Author:** ![Lars\_Andersson](https://avatars.discourse-cdn.com/v4/letter/l/f05b48/32.png) [@Lars\_Andersson](https://forums.losant.com/u/Lars_Andersson)\
**Post date:** [April 1, 2020, 9:08pm UTC](https://forums.losant.com/t/capture-payload/2778/6 "2020-04-01T21:08:33Z")

</div>

yes they are being sent to Losant via MQTT.  
Yes, just need to save to a Losant file for a test.

---

<div class="post-metadata">

**Author:** ![Anaz\_Zubair](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@Anaz\_Zubair](https://forums.losant.com/u/Anaz_Zubair)\
**Post date:** [April 2, 2020, 1:01pm UTC](https://forums.losant.com/t/capture-payload/2778/8 "2020-04-02T13:01:53Z")

</div>

If you want to store just the latest payload to a file, you can do that by using the Device: State trigger with a File: Create node. The payload will need be Json encoded, so you will need a Json: Encode node in between.

I could not find a way to append data to a file. File: Create node only allows to overwrite its contents. So, if you want to add payloads one by one, you will need to use workflow storage to store the current list as an array, add the new payload to the array, and then overwrite the file with the new list and update the workflow storage.

I did try to read the current list from the file itself using the Http Node, but I kept getting stale values probably due to http caching.

I wonder what is the size limit for a single item in Workflow storage?

 ![image](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/2X/4/47cc42e04737b06d39ef24a71750162eb05c54b3.png)
