From 07b91a81c169091b2464e6d587666ad3f0124a1e Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Tue, 20 Feb 2024 13:23:10 -0800 Subject: StringLowering: Escape the JSON in the custom section (#6316) Also add an end-to-end test using node to verify we can parse the escaped content properly using TextDecoder+JSON.parse. --- src/support/json.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/support/json.cpp') diff --git a/src/support/json.cpp b/src/support/json.cpp index d43ac0323..ab55cc75f 100644 --- a/src/support/json.cpp +++ b/src/support/json.cpp @@ -15,13 +15,13 @@ */ #include "support/json.h" +#include "support/string.h" namespace json { void Value::stringify(std::ostream& os, bool pretty) { if (isString()) { - // TODO: escaping - os << '"' << getCString() << '"'; + wasm::String::printEscapedJSON(os, getCString()); } else if (isArray()) { os << '['; auto first = true; -- cgit v1.2.3