web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Create a text file fro...
Power Automate
Unanswered

Create a text file from parse JSON step

(1) ShareShare
ReportReport
Posted on by 25

Good Afternoon,

@eliotcole

Thank you for the response in the older thread:

https://powerusers.microsoft.com/t5/Building-Flows/How-to-store-parsed-json-in-text-file/m-p/1671694#M185482

I am trying to take the output from a parse JSON step and create a .txt file.

Here is my full Schema. So not complicated at all and contains just a few items.

{
 "type": "object",
 "properties": {
 "Done": {
 "type": "object",
 "properties": {
 "WasabiFile": {
 "type": "object",
 "properties": {
 "Id": {
 "type": "string"
 },
 "FileName": {
 "type": "string"
 },
 "Contents": {
 "type": "string"
 }
 }
 }
 }
 }
 }
}

Example result would look something like this:

{
 "Done": {
 "WasabiFile": {
 "Id": "bd764a5f-f12c-4f34-aa2d-65cd428a5461",
 "FileName": "Rear Door Inspection 1.png",
 "Contents": "/9j/4AAQSk....(400,000 characters)

Where "Contents" is a string variable representing an image in BASE64 format.

My flow thus far looks like this. Bear in mind, I am constructing this in a Power BI Report using its Power Automate visual.

rsbin_0-1657820452157.png

Need to know what the next step in my flow should be in order to create what I think should be a text file.

Any help or further guidance would be much appreciated.

Thanks and Best Regards,

 

Categories:
I have the same question (0)
  • eliotcole Profile Picture
    4,363 Moderator on at

    Nice one, @rsbin, 👍

     

    If you're comfortable with dropping the parse JSON, you shouldn't need it for this as you'll be able to handle it in one step.

     

    Just use either a SharePoint or OneDrive Create file action, which will have up to four fields as below. Where you see the code blocks, those are expressions which you'll have to enter in the expression builder:

    Site Address* Select Manually
    Folder Path Select Manually
    File Name
    body('HTTP')?['Done/WasabiFile/FileName']
    File Content
    body('HTTP')?['Done/WasabiFile/Contents']

    * SharePoint only

     

    Once you have this action then you should be able to form logic to do whatever you need with the text file.

     

    If you'd like to use the contents of the text file elsewhere in the flow, then create a String type variable and in that place this expression:

    base64ToString(
     body('HTTP')?['Done/WasabiFile/Contents']
    )

    That *should* convert it to text that you can insert into any document that you're using elsewhere in the flow, and you can also try 'decodeBase64' instead of 'Base64ToString' in that.

  • rsbin Profile Picture
    25 on at

    @eliotcole,

    Thank you very much for the detailed response.  I have been called into meetings this afternoon, so when I get the chance to look at this in detail and follow your instructions, I will let you know how I make out.

    Thanks again!

  • rsbin Profile Picture
    25 on at

    Good Morning @eliotcole ,

    Have been able to take another step forward, but still need some assistance.

    First, feel more comfortable at this stage to leave the parse JSON step in there.

    Decided to use the Sharepoint Create File.

    rsbin_0-1657891152676.png

    I am using the id field as my filename, this step does create a file, but it doesn't seem to create any content.

    rsbin_1-1657891425556.png

    When I attempt to open the file, I get a dialogue box asking to look for an App

    Pretty sure I need to do something with the Contents Expression???

    Hope you don't mind continuing with your invaluable assistance.
    Best Regards,

     

  • Verified answer
    eliotcole Profile Picture
    4,363 Moderator on at

    You need to give it a file extension (like '.txt' or '.docx' ... etc) ... if it doesn't have that, systems won't know what to do with it.

     

    If you've got the content done right (which the Parse JSON if done properly shouldn't mess with) then there's going to be content in there.

     

    Just type the following directly after the id box that you have in the 'File Name' field:

    .txt

  • rsbin Profile Picture
    25 on at

    @eliotcole,

    Good Morning.  Thanks for the reply.  I was able to in fact, figure it out over the weekend.

    The content is in the file as expected.

    Again, thanks for taking the time to reply.

    All the Best and again appreciate your help in getting me started.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard