Skip to main content

Notifications

Community site session details

Community site session details

Session Id : R5X2cQvTq6PRMsnd4m/qek
Power Automate - General Discussion
Answered

Remove non-json text

Like (0) ShareShare
ReportReport
Posted on 4 Nov 2020 10:59:49 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  
  • Verified answer
    fmourtaza Profile Picture
    98 on 05 Nov 2020 at 02:36:09
    Re: Remove non-json text

    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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Leaderboard > Power Automate - General Discussion

#1
stampcoin Profile Picture

stampcoin 23

#2
Pstork1 Profile Picture

Pstork1 22 Most Valuable Professional

#3
Gprior Profile Picture

Gprior 19

Overall leaderboard
Loading started