Handling ConvertFrom-Json in PowerShell

Hi Everyone,
We are passing a JSON object from an IT Request in our Portal to PowerShell in Orchestrator. However, we're having problems with certain characters within the object being handled as escape characters. When that happens we receive the following error:

 

We found a way to partially solve the problem for slashes as follows:

               $SRDesc1_Prep = $SR.Description1

               $SRDesc1_formatted = $SRDesc1_prep -replace '\\','\\'

               $UserResponses = ConvertFrom-Json $SRDesc1_formatted

However, the Orchestrator Runbook still fails if someone enters a double quote into the description field:

 

I can't find a good way around it since the PowerShell would need to look inside of the double quotes for another single quote. I was wondering if anyone had encountered a similar issue or knows of a better way to handle this?

Thank you!

3 replies