通用编解码-方法介绍(更新中……)

以下常用方法列表,文档更新可能滞后于代码新特性,更多的方法及示例请参考代码文档:https://pkg.go.dev/github.com/gogf/gf/v2/encoding/gjson

Add

  • 说明:

  • 格式:

func New(data interface{}, safe ...bool) *Json
  • 示例:
func ExampleNew() {
    jsonContent := `{"name":"john", "score":"100"}`
    j := gjson.New(jsonContent)
    fmt.Println(j.Get("name"))
    fmt.Println(j.Get("score"))

    // Output:
    // john
    // 100
}

Add

  • 说明:

  • 格式:

  • 示例: