View strings in a string visualizer in Visual Studio
While you are debugging in Visual Studio, you can view strings with the built-in string visualizer. The string visualizer shows strings that are too long for a data tip or debugger window. It can also help you identify malformed strings.
The built-in string visualizers include plain text, XML, HTML, and JSON options. You can also open built-in tabular visualizers for a several .NET types, such as DataSet and IEnumerable) objects, from the Autos or other debugger windows.
Note
If you need to inspect XAML or WPF UI elements in a visualizer, see or Inspect XAML properties while debugging or How to use the WPF tree visualizer.
Open a string visualizer
To open the string visualizer, you must be paused during debugging. Hover over a variable that has a Text, XML, HTML, or JSON string value, and select the magnifying glass icon .
In the string visualizer window, the Expression field shows the variable or expression you're hovering over, and the Value field shows the string value.
A blank Value means that the chosen visualizer can't recognize the string. For example, the XML Visualizer shows a blank Value for a text string with no XML tags, or a JSON string.
View Text visualizer
The text visualizer shows textual data more conveniently. You can also use Text Visualizer to view strings that the chosen visualizer can't recognize. In addition, Text Visualizer provides tooling and string manipulation options and allows you to decode the following text with ease.
- Base64 Encode
- Base64 Decode
- URL Encode
- URL Decode
- JWT Decode
Select the String manipulation dropdown list and choose the desired option to decode your data.
View JSON string data
A well-formed JSON string appears similar to the following illustration in the JSON visualizer. Malformed JSON may display an error icon (or blank if unrecognized). To identify the JSON error, copy and paste the string into a JSON linting tool such as JSLint.
View XML string data
A well-formed XML string appears similar to the following illustration in the XML visualizer. Malformed XML may display without the XML tags, or blank if unrecognized.
View HTML string data
A well-formed HTML string appears as if rendered in a browser, as shown in the following illustration. Malformed HTML may display as plain text.