Skip to content

Commit 6774402

Browse files
committed
add Rune.MarshalJSON for pretty display
1 parent fb88a65 commit 6774402

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

rune.go

+5
Original file line numberDiff line numberDiff line change
@@ -198,3 +198,8 @@ func (e Error) Error() string {
198198
}
199199
return fmt.Sprintf("invalid character `%c`", e.Character)
200200
}
201+
202+
// MarshalJSON json marshal
203+
func (r Rune) MarshalJSON() ([]byte, error) {
204+
return []byte(`"` + r.String() + `"`), nil
205+
}

0 commit comments

Comments
 (0)