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

Announcements

News and Announcements icon
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 711

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:
  • Verified answer
    HansHeintz Profile Picture
    711 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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 321 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 271

#3
Henil Profile Picture

Henil 115

Last 30 days Overall leaderboard