Q. Special characters are causing problems when I try to use in JSON. How can I fix this?
Get a string ready for JSON with PowerShell
John Savill
September 23, 2015
1 Min Read
Q. I have a string with special characters that is causing problems when I try to use in JSON, how can I fix this?
A. Certain characters need to be "escaped" when used as part of JSON, like an ampersand (&). You can manually escape these characters, buta better route is to use the ConvertTo-Json cmdlet. That will output an escaped string of any passed string that can be used as part of a JSON file.
About the Author
Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.
You May Also Like