diff --git a/core/vm.cpp b/core/vm.cpp index a4328b4f0..020e89075 100644 --- a/core/vm.cpp +++ b/core/vm.cpp @@ -2549,7 +2549,8 @@ class Interpreter { // get GC'd. scratch = stack.top().val; stack.pop(); - ss << prefix << indent2 << U"\"" << f.first << U"\": " << vstr; + ss << prefix << indent2 << jsonnet_string_unparse(f.first, false) + << U": " << vstr; prefix = multiline ? U",\n" : U", "; } ss << (multiline ? U"\n" : U"") << indent << U"}"; diff --git a/test_suite/unparse.jsonnet b/test_suite/unparse.jsonnet index 42b533167..dbafd4799 100644 --- a/test_suite/unparse.jsonnet +++ b/test_suite/unparse.jsonnet @@ -27,6 +27,7 @@ limitations under the License. "false": false, "true": true, "null": null, + 'with"quote': '"', hidden_field:: null, ["hidden_field2"]:: null, } diff --git a/test_suite/unparse.jsonnet.fmt.golden b/test_suite/unparse.jsonnet.fmt.golden index e2d5b25e0..d57ae7e9c 100644 --- a/test_suite/unparse.jsonnet.fmt.golden +++ b/test_suite/unparse.jsonnet.fmt.golden @@ -27,6 +27,7 @@ limitations under the License. "false": false, "true": true, "null": null, + 'with"quote': '"', hidden_field:: null, hidden_field2:: null, } diff --git a/test_suite/unparse.jsonnet.golden b/test_suite/unparse.jsonnet.golden index e4adbdddd..28127f93c 100644 --- a/test_suite/unparse.jsonnet.golden +++ b/test_suite/unparse.jsonnet.golden @@ -10,5 +10,6 @@ "string": "'foo\n bar\n\n\"bar\u0005\"'\t P\b\f\r\\", "string2": "\"foo\n bar\n\n'bar\u0005\"'\t P\b\f\r\\", "true": true, + "with\"quote": "\"", "zero": 0 }