diff --git a/interpreter.go b/interpreter.go index 4a8607d..82d21cc 100644 --- a/interpreter.go +++ b/interpreter.go @@ -591,9 +591,7 @@ func (i *interpreter) manifestJSON(trace *TraceElement, v value, multiline bool, buf.WriteString(prefix) buf.WriteString(indent2) - buf.WriteString("\"") - buf.WriteString(fieldName) - buf.WriteString("\"") + buf.WriteString(unparseString(fieldName)) buf.WriteString(": ") // TODO(sbarzowski) body.Loc() diff --git a/testdata/escaped_fields.golden b/testdata/escaped_fields.golden new file mode 100644 index 0000000..bcb6393 --- /dev/null +++ b/testdata/escaped_fields.golden @@ -0,0 +1,5 @@ +{ + "\n\n": null, + "\"": null, + "'": null +} diff --git a/testdata/escaped_fields.input b/testdata/escaped_fields.input new file mode 100644 index 0000000..9c8f144 --- /dev/null +++ b/testdata/escaped_fields.input @@ -0,0 +1,8 @@ +{ + '"': null, + "'": null, + ||| + + + |||: null, +}