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

CSS Selector for <script type="application/ld+json"> contents

Hi,

I am trying to extract ld+json that is contained in a script element. I am not having luck writing the CSS selector to successfully capture the script contents. The script element in question is nested in the head element. The selector I have written is below along with a screenclip of some of the contents of the head element.

 

CSS selector: html > head script[type=application/ld+json]:eq(0)

Attribute: Own Text

 

Example site with such a structure. https://www.chewy.com/friskies-surfin-turfin-favorites-dry/dp/104296

 

Any help would be much appreciated.

 

Thanks,

John

 

jfk86d_0-1634960448210.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
jfk86d
Helper I
Helper I

Hi @PAG ,

Thank you very much for your response and solution. I implemented and it is able to return the JSON contained in the script. The Convert JSON to Custom Object does not parse it out. I get one text value that contains the entire contents (image below) vs the parsed JSON. 

So I ran the Results of the first Convert JSON to Custom Object through a 2nd Convert to JSON to Custom Object and it parsed it out then. Images below.

Thanks,

John

 

jfk86d_0-1635012481220.png

jfk86d_1-1635012674155.png

jfk86d_2-1635012710319.png

 

 

View solution in original post

5 REPLIES 5
PAG
Helper I
Helper I

Hello John,

 

Here is a solution if you don't mind using Javascript

https://power.automate.gallery/tF79vbbEqdHS 

 

jfk86d
Helper I
Helper I

Hi @PAG ,

Thank you very much for your response and solution. I implemented and it is able to return the JSON contained in the script. The Convert JSON to Custom Object does not parse it out. I get one text value that contains the entire contents (image below) vs the parsed JSON. 

So I ran the Results of the first Convert JSON to Custom Object through a 2nd Convert to JSON to Custom Object and it parsed it out then. Images below.

Thanks,

John

 

jfk86d_0-1635012481220.png

jfk86d_1-1635012674155.png

jfk86d_2-1635012710319.png

 

 

View solution in original post

BTW @PAG ,

How did you get to the Flow Actions view you posted in your link?

Thanks,

John

PAG
Helper I
Helper I

What PAD version are you using? I'm using 2.13.163.21263 and the JSON is parsed out correctly, no need to add additional "Convert JSON to custom object" actions.

 

PAG_0-1635056699968.png

 

What do you mean by "Flow actions view"?

@PAG Thanks. Your link above brought up a page that showed code as in the image below. How do you find that view of the code? Is that in PAD?

 

jfk86d_0-1635916711512.png

 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Users online (2,537)