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 Automate
Answered

Remove non-json text

(0) ShareShare
ReportReport
Posted on by 98
Environment : AzureCloud Tenant : nnnnnnnn-nnnn-nnnn-nnnn-nnnnnnnnnnnn TenantId : nnnnnnnn-nnnn-nnnn-nnnn-nnnnnnnnnnnn TenantDomain : contosoGroup.onmicrosoft.com [{ "DisplayName": "user1", "UserPrincipalName": "user1@contoso.com", "Department": null }, { "DisplayName": "user2", "UserPrincipalName": "user2@contoso.com", "Department": null }]

 

 

Hello Foks,

 

I want to remove all the "non-json" text which comes before the JSON.

 

using a compose action, I tried the following trim and replace combinations - however the result as not as expected.

 

trim(replace(replace(replace(last(split(outputs('Compose'), 'TenantDomain')), ':', ''), '}', ''), '"', ''))

 

trim(replace(replace(replace(last(split(outputs('Compose'), 'contosoGroup.onmicrosoft.com')), ':', ''), '}', ''), '"', ''))

 

Please help. 

 

Thanks,

 

 

Account : nnnnnnnn-nnnn-nnnn-nnnn-nnnnnnnnnnnn  
Categories:
I have the same question (0)
  • Verified answer
    fmourtaza Profile Picture
    98 on at

    I used Substring to remove the initial part of the text, as follows:

     

    A. Starting Position: indexOf(outputs('Raw_Data'),'[')
    B.Total length: length(outputs('Raw_Data'))
    C.Length (Difference): sub(outputs('Total_Length'),outputs('Starting_Position'))

     

    Substring Connectors:
    Text: Raw Data output
    Starting Position: A
    Lenght: C

     

    fmourtaza_0-1604543562478.png

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 262 Super User 2026 Season 1

#2
Haque Profile Picture

Haque 227

#3
Expiscornovus Profile Picture

Expiscornovus 225 Most Valuable Professional

Last 30 days Overall leaderboard