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

Community site session details

Session Id :
Power Automate - Building Flows
Answered

How to parse a JSON which is wrapped in a XML?

(0) ShareShare
ReportReport
Posted on by

Hello,

 

I am receiving a response from an API via a "Get web resource" action. The output is a base64 application/octet stream. With a "Initialize Variable", I convert this to a string. Now, I would like to parse the json elements in this string. Do I need to remove the xml and string part with substring and replace or is there a better solution to get the values out of this string?

 

BR

Kay

 

<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://tempuri.org/">[{"Event_ID":"296485","Response_User":"","Receiving_Group_ID":"16","Created_User":"M-171","Event_Description":"\u003c Scrap Warning at machine M-171 requires your attention 1 Escalations 10:55:05 PM\u003e | WARNUNG Scrap Verletzung an Maschine M-171 3.70 %, Auftrag 2002275342710020, 1 Verletzungen, 10:55:05 PM","Created_Date":"14/05/2023 22:55:07","Notification_Date":"14/05/2023 22:55:12","Close_Date":"","Response_Date":"","Event_Status":"1","Event_Type_ID":"4","Event_Type_Name":"MRA_SCRAP_VIOL"},{"Event_ID":"296486","Response_User":"","Receiving_Group_ID":"16","Created_User":"M-116","Event_Description":"\u003c Scrap Alert at machine M-116 requires your attention 52 Escalations 10:55:05 PM\u003e | ALARM Scrap Verletzung an Maschine M-116 8.00%, Ausschußgrenze 1.50, Auftrag 2002276077580020, 52 Escalations, 10:55:05 PM","Created_Date":"14/05/2023 22:55:07","Notification_Date":"14/05/2023 22:55:12","Close_Date":"","Response_Date":"","Event_Status":"1","Event_Type_ID":"4","Event_Type_Name":"MRA_SCRAP_VIOL"},{"Event_ID":"296473","Response_User":"","Receiving_Group_ID":"16","Created_User":"M-116","Event_Description":"\u003c Scrap Alert at machine M-116 requires your attention 45 Escalations 10:20:12 PM\u003e | ALARM Scrap Verletzung an Maschine M-116 21.21%, Ausschußgrenze 1.50, Auftrag 2002276077580020, 45 Escalations, 10:20:12 PM","Created_Date":"14/05/2023 22:20:14","Notification_Date":"14/05/2023 22:20:21","Close_Date":"","Response_Date":"","Event_Status":"1","Event_Type_ID":"4","Event_Type_Name":"MRA_SCRAP_VIOL"},{"Event_ID":"296474","Response_User":"","Receiving_Group_ID":"16","Created_User":"M-185","Event_Description":"\u003c Scrap Warning at machine M-185 requires your attention 1 Escalations 10:25:05 PM\u003e | WARNUNG Scrap Verletzung an Maschine M-185 6.67 %, Auftrag 2002276714750020, 1 Verletzungen, 10:25:05 PM","Created_Date":"14/05/2023 22:25:09","Notification_Date":"14/05/2023 22:25:18","Close_Date":"","Response_Date":"","Event_Status":"1","Event_Type_ID":"4","Event_Type_Name":"MRA_SCRAP_VIOL"},{"Event_ID":"296475","Response_User":"","Receiving_Group_ID":"16","Created_User":"M-116","Event_Description":"\u003c Scrap Alert at machine M-116 requires your attention 46 Escalations 10:25:05 PM\u003e | ALARM Scrap Verletzung an Maschine M-116 16.00%, Ausschußgrenze 1.50, Auftrag 2002276077580020, 46 Escalations, 10:25:05 PM","Created_Date":"14/05/2023 22:25:09","Notification_Date":"14/05/2023 22:25:18","Close_Date":"","Response_Date":"","Event_Status":"1","Event_Type_ID":"4","Event_Type_Name":"MRA_SCRAP_VIOL"},{"Event_ID":"296476","Response_User":"","Receiving_Group_ID":"16","Created_User":"Z-618B","Event_Description":"\u003c Scrap Alert at machine Z-618B requires your attention 1 Escalations 10:30:12 PM\u003e | ALARM Scrap Verletzung an Maschine Z-618B 16.67%, Ausschußgrenze 3.00, Auftrag 2002276143380120, 1 Escalations, 10:30:12 PM","Created_Date":"14/05/2023 22:30:13","Notification_Date":"14/05/2023 22:30:15","Close_Date":"","Response_Date":"","Event_Status":"1","Event_Type_ID":"4","Event_Type_Name":"MRA_SCRAP_VIOL"},{"Event_ID":"296477","Response_User":"","Receiving_Group_ID":"16","Created_User":"M-116","Event_Description":"\u003c Scrap Alert at machine M-116 requires your attention 47 Escalations 10:30:12 PM\u003e | ALARM Scrap Verletzung an Maschine M-116 32.00%, Ausschußgrenze 1.50, Auftrag 2002276077580020, 47 Escalations, 10:30:12 PM","Created_Date":"14/05/2023 22:30:13","Notification_Date":"14/05/2023 22:30:15","Close_Date":"","Response_Date":"","Event_Status":"1","Event_Type_ID":"4","Event_Type_Name":"MRA_SCRAP_VIOL"},{"Event_ID":"296478","Response_User":"","Receiving_Group_ID":"16","Created_User":"M-148","Event_Description":"\u003c Scrap Warning at machine M-148 requires your attention 1 Escalations 10:35:06 PM\u003e | WARNUNG Scrap Verletzung an Maschine M-148 23.53 %, Auftrag 2002276714610020, 1 Verletzungen, 10:35:06 PM","Created_Date":"14/05/2023 22:35:08","Notification_Date":"14/05/2023 22:35:12","Close_Date":"","Response_Date":"","Event_Status":"1","Event_Type_ID":"4","Event_Type_Name":"MRA_SCRAP_VIOL"},{"Event_ID":"296479","Response_User":"","Receiving_Group_ID":"16","Created_User":"M-185","Event_Description":"\u003c Scrap Warning at machine M-185 requires your attention 1 Escalations 10:35:06 PM\u003e | WARNUNG Scrap Verletzung an Maschine M-185 12.50 %, Auftrag 2002276714750020, 1 Verletzungen, 10:35:06 PM","Created_Date":"14/05/2023 22:35:08","Notification_Date":"14/05/2023 22:35:12","Close_Date":"","Response_Date":"","Event_Status":"1","Event_Type_ID":"4","Event_Type_Name":"MRA_SCRAP_VIOL"},{"Event_ID":"296480","Response_User":"","Receiving_Group_ID":"16","Created_User":"M-116","Event_Description":"\u003c Scrap Alert at machine M-116 requires your attention 48 Escalations 10:35:06 PM\u003e | ALARM Scrap Verletzung an Maschine M-116 15.15%, Ausschußgrenze 1.50, Auftrag 2002276077580020, 48 Escalations, 10:35:06 PM","Created_Date":"14/05/2023 22:35:08","Notification_Date":"14/05/2023 22:35:12","Close_Date":"","Response_Date":"","Event_Status":"1","Event_Type_ID":"4","Event_Type_Name":"MRA_SCRAP_VIOL"},{"Event_ID":"296481","Response_User":"","Receiving_Group_ID":"16","Created_User":"Z-618B","Event_Description":"\u003c Scrap Alert at machine Z-618B requires your attention 1 Escalations 10:40:10 PM\u003e | ALARM Scrap Verletzung an Maschine Z-618B 14.29%, Ausschußgrenze 3.00, Auftrag 2002276143380120, 1 Escalations, 10:40:10 PM","Created_Date":"14/05/2023 22:40:13","Notification_Date":"14/05/2023 22:40:20","Close_Date":"","Response_Date":"","Event_Status":"1","Event_Type_ID":"4","Event_Type_Name":"MRA_SCRAP_VIOL"},{"Event_ID":"296482","Response_User":"","Receiving_Group_ID":"16","Created_User":"M-116","Event_Description":"\u003c Scrap Alert at machine M-116 requires your attention 49 Escalations 10:40:10 PM\u003e | ALARM Scrap Verletzung an Maschine M-116 20.83%, Ausschußgrenze 1.50, Auftrag 2002276077580020, 49 Escalations, 10:40:10 PM","Created_Date":"14/05/2023 22:40:13","Notification_Date":"14/05/2023 22:40:20","Close_Date":"","Response_Date":"","Event_Status":"1","Event_Type_ID":"4","Event_Type_Name":"MRA_SCRAP_VIOL"},{"Event_ID":"296483","Response_User":"","Receiving_Group_ID":"16","Created_User":"M-116","Event_Description":"\u003c Scrap Alert at machine M-116 requires your attention 50 Escalations 10:45:05 PM\u003e | ALARM Scrap Verletzung an Maschine M-116 24.00%, Ausschußgrenze 1.50, Auftrag 2002276077580020, 50 Escalations, 10:45:05 PM","Created_Date":"14/05/2023 22:45:08","Notification_Date":"14/05/2023 22:45:18","Close_Date":"","Response_Date":"","Event_Status":"1","Event_Type_ID":"4","Event_Type_Name":"MRA_SCRAP_VIOL"},{"Event_ID":"296484","Response_User":"","Receiving_Group_ID":"16","Created_User":"M-116","Event_Description":"\u003c Scrap Alert at machine M-116 requires your attention 51 Escalations 10:50:12 PM\u003e | ALARM Scrap Verletzung an Maschine M-116 12.12%, Ausschußgrenze 1.50, Auftrag 2002276077580020, 51 Escalations, 10:50:12 PM","Created_Date":"14/05/2023 22:50:12","Notification_Date":"14/05/2023 22:50:15","Close_Date":"","Response_Date":"","Event_Status":"1","Event_Type_ID":"4","Event_Type_Name":"MRA_SCRAP_VIOL"}]</string>

 

I have the same question (0)
  • Verified answer
    v-xiaochen-msft Profile Picture
    on at
    Re: How to parse a JSON which is wrapped in a XML?

    Hi @Kayle ,

     

    Please try this:

    vxiaochenmsft_0-1684119715118.png

    json(json(xml(variables('var')))?['string/#text'])
     
    Best Regards,
    Wearsky
  • Kayle Profile Picture
    on at
    Re: How to parse a JSON which is wrapped in a XML?

    Hi @v-xiaochen-msft ,

     

    simple and perfect solution. Thank you very much.

     

    BR

    Kay

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 655 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 371 Moderator

#3
chiaraalina Profile Picture

chiaraalina 276

Last 30 days Overall leaderboard