make json data printable

This commit is contained in:
ajatprabha 2021-09-18 17:55:59 +05:30 committed by Ken Hibino
parent 3839f96b44
commit c98d65dcdb

View File

@ -1,6 +1,7 @@
package asynqmon
import (
"encoding/json"
"time"
"unicode"
"unicode/utf8"
@ -226,6 +227,9 @@ func isPrintable(data []byte) bool {
if !utf8.Valid(data) {
return false
}
if json.Valid(data) {
return true
}
isAllSpace := true
for _, r := range string(data) {
if !unicode.IsPrint(r) {