diff --git a/ast/print.go b/ast/print.go index 394e0c1a..6a7d698a 100644 --- a/ast/print.go +++ b/ast/print.go @@ -215,7 +215,7 @@ func (n *PairNode) String() string { if utils.IsValidIdentifier(str.Value) { return fmt.Sprintf("%s: %s", str.Value, n.Value.String()) } - return fmt.Sprintf("%q: %s", str.String(), n.Value.String()) + return fmt.Sprintf("%s: %s", str.String(), n.Value.String()) } return fmt.Sprintf("(%s): %s", n.Key.String(), n.Value.String()) } diff --git a/ast/print_test.go b/ast/print_test.go index 373030a4..4ad49714 100644 --- a/ast/print_test.go +++ b/ast/print_test.go @@ -57,6 +57,10 @@ func TestPrint(t *testing.T) { {`{}`, `{}`}, {`{a: b}`, `{a: b}`}, {`{a: b, c: d}`, `{a: b, c: d}`}, + {`{"a": b, 'c': d}`, `{a: b, c: d}`}, + {`{"a": b, c: d}`, `{a: b, c: d}`}, + {`{"a": b, 8: 8}`, `{a: b, "8": 8}`}, + {`{"9": 9, '8': 8, "foo": d}`, `{"9": 9, "8": 8, foo: d}`}, {`[]`, `[]`}, {`[a]`, `[a]`}, {`[a, b]`, `[a, b]`},