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 Platform Community / Forums / Power Apps / Line breaks causing in...
Power Apps
Unanswered

Line breaks causing invalid JSON

(0) ShareShare
ReportReport
Posted on by 15
Hi.
 
I have a Power Automate flow that applies queries to a Sharepoint List, does a few other stuff to query the result, and then sends the result back as JSON (but actually as an escaped string). At PowerApps, I take the escaped string, put it in a variable and parse it into actual JSON, and then convert that to a table to view in a gallery [Gallery, Items -> Table(ParseJSON(variablename))]. There is a field in the Sharepoint List for a multiline string. It has all been working fine, until I put in a record with line breaks. In the escaped string (variablename), they show as /n, but when the JSON is parsed using ParseJSON(), it parses the string within the JSON as well, causing an illegal line break in the JSON. How can I still parse the JSON without parsing the "/n" markers in the string within the JSON?

Many thanks in advance
Eddie
Categories:
I have the same question (0)
  • v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @eddiecoldrick ,

     

    I've made a test but the ParseJSON did not parse the /n .

    vbofengmsft_0-1689212667368.png

    Could you give me an example of the string to parse and the result you want?

     

     

    Best Regards,

    Bof

     

  • eddiecoldrick Profile Picture
    15 on at

    Hi @v-bofeng-msft 

     

    Thanks for the response. Please see the sample JSON that is sent from Power Automate below (I have redacted my email address, so the [redacted] would usually just be an email):

     

    "body": {

            "jsonresult""[{\"title\":\"1\", \"teamread\":\"False\", \"info\":\"This is a test of the new system\",\"created\":\"06/07/23\", \"creator\":\"[redacted]\", \"status\":\"open\"},{\"title\":\"2\", \"teamread\":\"False\", \"info\":\"Test 2 ajhfaslsjfsjfhasjfhasjfhsajfhajhfjahfjkahfjhashfjkashfjahsfjkhajshfjahjfhasjfhajshfkjahfjkhasjfhajkshfjashfjkahsjfkhakjsfhksajhfjkghjsdjghgjhsdg\",\"created\":\"06/07/23\", \"creator\":\"[redacted]\", \"status\":\"open\"},{\"title\":\"3\", \"teamread\":\"False\", \"info\":\"fafasfasfafjasfhjashfhasifhaihfihshsifihihiihfahihifhfsihfishfihfiahsifhihfiahsfihifhishifhasifhihsasifhiashfihfihaifhaisfhiashsifhasifhashfihdjadjiajdijdiajdijadija\",\"created\":\"07/07/23\", \"creator\":\"[redacted]\", \"status\":\"open\"},{\"title\":\"4\", \"teamread\":\"True\", \"info\":\"ijfijdfhjasdikjdsafgjdsgikjdsgjifasjidsagfidsjiafsjidasgkodfjhiadmkdsfjik\",\"created\":\"07/07/23\", \"creator\":\"[redacted]\", \"status\":\"closed\"},{\"title\":\"5\", \"teamread\":\"False\", \"info\":\"This is a test with a PDF attached. I really hope this works as expected! Yay!\n\nLorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\",\"created\":\"12/07/23\", \"creator\":\"[redacted]\", \"status\":\"open\"}]"

        }
     

     

    The error occurs when the JSON is parsed and it points to the "info" string in the last record where there is a line break. Not sure why you can't reproduce.
     
    Hope this makes sense and thanks for the help
    Eddie

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!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 936

#2
Valantis Profile Picture

Valantis 604

#3
11manish Profile Picture

11manish 518

Last 30 days Overall leaderboard