cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
RichardUchytil
Advocate I
Advocate I

How to parse JSON output from Adobe Services Extract

We are wanting to parse a PDF email attachment, extracting specific text and putting it into a SQL Server database. 

 

I'm using Adobe Services "Extract PDF Structure in JSON File".  The output is outputs('Extract_PDF_Structure_in_a_JSON_File')?['body/jsonFileContent'], which is unreadable.  How do I convert that to something I can work with?

 

Also, I was able to output that to a JSON file.  I don't know much about JSON.  When I open the file in Notepad++ I see there are four sections, "pages", "extended_metadata", "elements", and "version".  I only need the data in the "elements" section, and that section is a JSON array.

RichardUchytil_1-1648054398857.png

 

In the "elements" array the fields I need are all called "Text":

RichardUchytil_3-1648054638162.png

 

Any suggestions how to get this data so I can put it into a database?  Thanks!

 

Here's my flow:

RichardUchytil_0-1648054368176.png

 

And the run:

RichardUchytil_2-1648054437005.png

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Figured it out!!  I have a compose that does base64ToString, a compose that converts that to JSON, then a select that pulls out the value I need.

 

Here's the flow:

RichardUchytil_0-1648073374936.png

First Compose:  base64ToString(outputs('Extract_PDF_Structure_in_a_JSON_File')?['body/jsonFileContent'])

 
Compose 2: json(outputs('Compose'))
 
Select From: Outputs('Compose_2')['elements']
Map: item()?['Path']
         item()?['Text']
 
The output of the Select:
RichardUchytil_1-1648073603007.png

 

Now I've got data I can insert into SQL Server!  Thanks very much for the base64 tip!

View solution in original post

4 REPLIES 4
Manar
Super User
Super User

Hi @RichardUchytil ,

Try base64 

 

https://debajmecrm.com/binary-to-base64-in-microsoft-power-automate-microsoft-flow/ 

Thank you,
Manar

If you like this post, give it aThumbs Up. Where it solved your query, mark it as a SOLUTION so it can help other people!

Great!  That changes it into readable text!

 

But now how do I tell my flow to only use the array in the "elements" section?

Figured it out!!  I have a compose that does base64ToString, a compose that converts that to JSON, then a select that pulls out the value I need.

 

Here's the flow:

RichardUchytil_0-1648073374936.png

First Compose:  base64ToString(outputs('Extract_PDF_Structure_in_a_JSON_File')?['body/jsonFileContent'])

 
Compose 2: json(outputs('Compose'))
 
Select From: Outputs('Compose_2')['elements']
Map: item()?['Path']
         item()?['Text']
 
The output of the Select:
RichardUchytil_1-1648073603007.png

 

Now I've got data I can insert into SQL Server!  Thanks very much for the base64 tip!

The PDF structure is stored as string in the structuredJsonObjectKey
I have used the following Compose action to retrieve the values of interest. Was then able to select the values I need in dataverse. 
json(outputs('Extract_PDF_Structure_in_a_JSON_Object')?['body/structuredJsonObject'])

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

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

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Top Solution Authors
Users online (1,742)