Skip to main content

Notifications

Community site session details

Community site session details

Session Id : IKaAETFOcWTyyvZ1SYEC6f
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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

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

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Automate - General Discussion

#1
David_MA Profile Picture

David_MA 8 Super User 2025 Season 1

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 8 Super User 2025 Season 1

#3
ankit_singhal Profile Picture

ankit_singhal 7 Super User 2025 Season 1

Overall leaderboard
Loading started