Skip to content

Commit de33dbb

Browse files
committed
json: add space between k:v when prettyprinting.
Signed-off-by: Eric Myhre <hash@exultant.us>
1 parent d6cc652 commit de33dbb

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

json/jsonCommon.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ var (
1515
wordMapClose = []byte("}")
1616
wordColon = []byte(":")
1717
wordComma = []byte(",")
18+
wordSpace = []byte(" ")
1819
)

json/jsonEncoder.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ func (d *Encoder) Step(tok *Token) (done bool, err error) {
9191
d.entrySep()
9292
d.emitString(tok.Str)
9393
d.wr.Write(wordColon)
94+
if d.cfg.Line != nil {
95+
d.wr.Write(wordSpace)
96+
}
9497
d.current = phase_mapExpectValue
9598
return false, nil
9699
default:

0 commit comments

Comments
 (0)