fix: big number lose precision via view as JSON format #52
This commit is contained in:
parent
a4412d21d4
commit
76734989d5
|
@ -175,14 +175,11 @@ func autoToType(str string) (value, resultType string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func decodeJson(str string) (string, bool) {
|
func decodeJson(str string) (string, bool) {
|
||||||
var data any
|
|
||||||
if (strings.HasPrefix(str, "{") && strings.HasSuffix(str, "}")) ||
|
if (strings.HasPrefix(str, "{") && strings.HasSuffix(str, "}")) ||
|
||||||
(strings.HasPrefix(str, "[") && strings.HasSuffix(str, "]")) {
|
(strings.HasPrefix(str, "[") && strings.HasSuffix(str, "]")) {
|
||||||
if err := json.Unmarshal([]byte(str), &data); err == nil {
|
var out bytes.Buffer
|
||||||
var jsonByte []byte
|
if err := json.Indent(&out, []byte(str), "", " "); err == nil {
|
||||||
if jsonByte, err = json.MarshalIndent(data, "", " "); err == nil {
|
return out.String(), true
|
||||||
return string(jsonByte), true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return str, false
|
return str, false
|
||||||
|
|
Loading…
Reference in New Issue