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 / collection powerapps t...
Power Automate
Answered

collection powerapps to JSon: parse error after creating syntax from sample load

(1) ShareShare
ReportReport
Posted on by 704

Hi, 

Been using for years some code from Youtuber Sean Young for storing attachments from powerapps to sharepoint using a flow.

In a new environment this flow, with the old powerapps trigger, will not be added to the app so I created a new with the new trigger.

The (text) input is a collection containg filenames and file contents as json of attachment control "images".

The resulting text in powerapps that the flow uses looks like this (i substituted ..... for a large part of the file content)

Column base64 will be used for the body of the eventual file.

 

[
{
"Name": "cat.jpeg",
"UniqueName": "86170723-8cat.jpeg",
"base64": "/9j/...../9k="
}
]

 

 

Since the original syntax for parse json from Sean Youngs example is not working (I get InvalidJSON error) I use this text to have powerautomate generate  json syntax

The syntax looks ok but If I enter the same text testing I get the same error

InvalidJSON

The 'content' property of actions of type 'ParseJson' must be valid JSON. The provided value cannot be parsed: 'Unexpected character encountered while parsing value: F. Path '', line 0, position 0.'.
 
Below are the syntax in power automate and the code in powerapps.
Anyone an idea

 

 

{
 "type": "array",
 "items": {
 "type": "object",
 "properties": {
 "Name": {
 "type": "string"
 },
 "UniqueName": {
 "type": "string"
 },
 "base64": {
 "type": "string"
 }
 },
 "required": [
 "Name",
 "UniqueName",
 "base64"
 ]
 }
}

 

 

The flow uses compose, parse jason, apply to each (save file).

In parse Jason I use

 

Powerapps code adapted to my situation:

 

;ClearCollect(
 ColFiles
 ,ShowColumns(
 AddColumns(
 gAttachments.AllItems
 ,base64
 ,With(
 {
 varDemoFromAttachmentcontrol
 :JSON(
 Image4.Image
 ,JSONFormat.IncludeBinaryData
 )
 }
 ,Mid(
 varDemoFromAttachmentcontrol
 ,Find(",",varDemoFromAttachmentcontrol)+1
 ,Len(varDemoFromAttachmentcontrol) - Find(",",varDemoFromAttachmentcontrol)-1 
 )
 )
 ,UniqueName,Left(GUID(),10) & Name 
 ,ThisImage,Image4.Image 
 ) 
 ,base64
 ,Name
 ,UniqueName
 //;"ThisImage"
 )
 ) 

 

I see Sean did some editing of the file content so I also tried the unedited JSON of the attachment control image contents but same result.

Categories:
I have the same question (0)
  • Verified answer
    HansHeintz Profile Picture
    704 on at

     Never mind I found a later video by Sean on how to deal with the new powerapps trigger v2

     

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
David_MA Profile Picture

David_MA 265 Super User 2025 Season 2

#2
Expiscornovus Profile Picture

Expiscornovus 203 Most Valuable Professional

#3
trice602 Profile Picture

trice602 202 Super User 2025 Season 2

Last 30 days Overall leaderboard