diff --git a/codec/dagjson/multicodec.go b/codec/dagjson/multicodec.go index 7a035d2e873f12425eb76a2a25578b43efc7804b..00defd47e26ed197306951543e65a27574723bef 100644 --- a/codec/dagjson/multicodec.go +++ b/codec/dagjson/multicodec.go @@ -54,7 +54,7 @@ func Encode(n ipld.Node, w io.Writer) error { // (There's not really any fastpaths of note for json.) // Write another function if you need to tune encoding options about whitespace. return Marshal(n, json.NewEncoder(w, json.EncodeOptions{ - Line: []byte{'\n'}, - Indent: []byte{'\t'}, + Line: nil, + Indent: nil, }), true) } diff --git a/codec/dagjson/roundtripBytes_test.go b/codec/dagjson/roundtripBytes_test.go index df4e9f636b01b2bc7a5e3f3cc2bd1374bd95120d..ccbef3e7f6ca9eb9d1a052290102f2aaf807bed9 100644 --- a/codec/dagjson/roundtripBytes_test.go +++ b/codec/dagjson/roundtripBytes_test.go @@ -15,15 +15,7 @@ var byteNode = fluent.MustBuildMap(basicnode.Prototype__Map{}, 4, func(na fluent na.AssembleEntry("plain").AssignString("olde string") na.AssembleEntry("bytes").AssignBytes([]byte("deadbeef")) }) -var byteSerial = `{ - "plain": "olde string", - "bytes": { - "/": { - "bytes": "ZGVhZGJlZWY=" - } - } -} -` +var byteSerial = `{"plain":"olde string","bytes":{"/":{"bytes":"ZGVhZGJlZWY="}}}` func TestRoundtripBytes(t *testing.T) { t.Run("encoding", func(t *testing.T) { @@ -46,16 +38,7 @@ var encapsulatedNode = fluent.MustBuildMap(basicnode.Prototype__Map{}, 1, func(n sa.AssembleEntry("bytes").AssignBytes([]byte("deadbeef")) }) }) -var encapsulatedSerial = `{ - "/": { - "bytes": { - "/": { - "bytes": "ZGVhZGJlZWY=" - } - } - } -} -` +var encapsulatedSerial = `{"/":{"bytes":{"/":{"bytes":"ZGVhZGJlZWY="}}}}` func TestEncapsulatedBytes(t *testing.T) { t.Run("encoding", func(t *testing.T) { diff --git a/codec/dagjson/roundtrip_test.go b/codec/dagjson/roundtrip_test.go index 757fc6c2195156199e8fefa79e8c5bf2f11778e3..18896804c4ed9077a5f138647dc118883bfa8c3a 100644 --- a/codec/dagjson/roundtrip_test.go +++ b/codec/dagjson/roundtrip_test.go @@ -27,23 +27,7 @@ var n = fluent.MustBuildMap(basicnode.Prototype__Map{}, 4, func(na fluent.MapAss }) }) }) -var serial = `{ - "plain": "olde string", - "map": { - "one": 1, - "two": 2 - }, - "list": [ - "three", - "four" - ], - "nested": { - "deeper": [ - "things" - ] - } -} -` +var serial = `{"plain":"olde string","map":{"one":1,"two":2},"list":["three","four"],"nested":{"deeper":["things"]}}` func TestRoundtrip(t *testing.T) { t.Run("encoding", func(t *testing.T) {