cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
_jesan_
Helper I
Helper I

Issue parsing a JSON file from OneDrive for Business

I'm having some issues trying to parse a JSON file from OneDrive for Business

 

  • My flow triggers when a new file is created (All files in the folder are json type).
  • I use the next JSON file 
{"Prueba":"Hola mundo"}

 

 

json(base64ToString(trigger()['outputs']['body']['$content']))

 

  • When I run the flow I get the next message:
Unable to process template language expressions in action 'Compose' inputs at line '1' and column '2816': 'The template language function 'json' parameter is not valid. The provided value '{
"Prueba":"Hola mundo"
}' cannot be parsed: 'Unexpected character encountered while parsing value: . Path '', line 0, position 0.'. Please see https://aka.ms/logicexpressions#json for usage details.'.

 

  • I tried using the Parse JSON action having the same results

 

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
ChristianAbata
Super User
Super User

hi @_jesan_  maeby I did what you want

 

base64ToString(triggerBody()?['$content'])

 

 

try.PNG

result.

ok.PNG 



Did I answer your question? Please consider to Mark
my post as a solution! to guide others :winking_face:

Proud to be a Flownaut!


If you want you can follow me at www.christianabata.com Quieres contenido en español? Síguenos en Power Automate LA

View solution in original post

I've found the problem of the issue.
The program that creates JSON's files was using a utf-8 with BOM.
I created another file with flow and noticed this difference that file must be created with utf-8 codification.
Thanks four your replies.

View solution in original post

5 REPLIES 5
abm
Super User
Super User

Hi @_jesan_ 

 

Could you please post a screenshot of your flow?  

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials
ChristianAbata
Super User
Super User

hi @_jesan_  maeby I did what you want

 

base64ToString(triggerBody()?['$content'])

 

 

try.PNG

result.

ok.PNG 



Did I answer your question? Please consider to Mark
my post as a solution! to guide others :winking_face:

Proud to be a Flownaut!


If you want you can follow me at www.christianabata.com Quieres contenido en español? Síguenos en Power Automate LA

Hello @_jesan_

@ChristianAbata is correct, after doing the steps he posted. You can add another compose action and use the expression:
json()
And inside the () you can put the dynamic content of the base64 output.
Than run the flow, copy the output from the Json expression.
Now you can add a parse JSON action and use the copied value as the sample payload.

—Josh
If you like my post please hit the "Thumbs Up" -- If my post solved your issue please "Mark as a Solution" to help others

Did I answer your question? Mark my post as a solution!

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips,
tricks, and guides
FlowAltDelete





Hi, I tried your aproach but I get same results

Imagen2.PNG

Result:

Imagen1.PNG

I noticed there's difference in each output action result when JSON is involved.
It seems that when a output is identified as a valid JSON the pair "name:value" is shown with color, but when I use the first Compose action it seems that this colors are not shown in the same way.

Imegen3.PNG

 

I've found the problem of the issue.
The program that creates JSON's files was using a utf-8 with BOM.
I created another file with flow and noticed this difference that file must be created with utf-8 codification.
Thanks four your replies.

Helpful resources

Announcements
Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (2,625)