diff --git a/src/utils/jsonToHtml.ts b/src/utils/jsonToHtml.ts
index 73f1a2b482..414c3c76a8 100644
--- a/src/utils/jsonToHtml.ts
+++ b/src/utils/jsonToHtml.ts
@@ -21,6 +21,10 @@ function htmlEncode(t) {
: '';
}
+function escapeStringQuotes(str: string) {
+ return str.replace(/"/g, '\\"');
+}
+
function decorateWithSpan(value, className) {
return '' + htmlEncode(value) + '';
}
@@ -53,11 +57,11 @@ function valueToHTML(value) {
'' +
- htmlEncode(value) +
+ htmlEncode(escapeStringQuotes(value)) +
'' +
decorateWithSpan('"', 'token string');
} else {
- output += decorateWithSpan('"' + value + '"', 'token string');
+ output += decorateWithSpan('"' + escapeStringQuotes(value) + '"', 'token string');
}
} else if (valueType === 'boolean') {
output += decorateWithSpan(value, 'token boolean');