代码拉取完成,页面将自动刷新
package json
import (
"encoding/json"
"strings"
"syscall"
)
// -----------------------------------------------------------------------------
// Pretty prints a value in pretty mode.
//
func Pretty(v interface{}) string {
b, err := json.MarshalIndent(v, "", " ")
if err != nil {
return err.Error()
}
return string(b)
}
// Unmarshal unmarshals a []byte or string
//
func Unmarshal(b interface{}) (v interface{}, err error) {
switch in := b.(type) {
case []byte:
err = json.Unmarshal(in, &v)
case string:
err = json.NewDecoder(strings.NewReader(in)).Decode(&v)
default:
err = syscall.EINVAL
}
return
}
// Exports is the export table of this module.
//
var Exports = map[string]interface{}{
"_name": "encoding/json",
"decoder": json.NewDecoder,
"encoder": json.NewEncoder,
"marshal": json.Marshal,
"marshalIndent": json.MarshalIndent,
"pretty": Pretty,
"unmarshal": Unmarshal,
"compact": json.Compact,
"indent": json.Indent,
"htmlEscape": json.HTMLEscape,
}
// -----------------------------------------------------------------------------
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。