How to escape double quotes from the value of a JSON field

Hi All,

We are getting data from Sharepoint using a!httpQuery in json format and then converting it to appian value using a!fromJson to use in the application. It all works fine except for the scenario where the value for a json field has some word with double quotes.

For Ex:

{"Title":"This is an "example" to show the issue",

"Name":"Some value",

"Created":"9/25/2017 8:49:53 AM"

}

In the above code snippet, the issue happens as example is in double quotes. We cannot restrict the source system, so we have to take care of it on our end. 

How can we escape the double quotes here.

Any response is appreciated. Thanks in advance.

  Discussion posts and replies are publicly visible

Parents
  • If you know the json fields ahead of time, you could preprocess the text before passing it to a!fromjson(). You could do a search to find "Title", "Name", and "Created", then take the values in between the fields ("This is an "example" to show the issue"), and manually replace the quotation marks in the value. You would then feed the resulting strint to a!fromjson.

    I'm inclined to say that this is technically invalid json. You could use one of the many online validation tools out there to make a case that the source system makes a change because it's generating invalid data.
Reply
  • If you know the json fields ahead of time, you could preprocess the text before passing it to a!fromjson(). You could do a search to find "Title", "Name", and "Created", then take the values in between the fields ("This is an "example" to show the issue"), and manually replace the quotation marks in the value. You would then feed the resulting strint to a!fromjson.

    I'm inclined to say that this is technically invalid json. You could use one of the many online validation tools out there to make a case that the source system makes a change because it's generating invalid data.
Children
No Data