MCPcopy
hub / github.com/gogf/gf / ExampleJson_GetJsons

Function ExampleJson_GetJsons

encoding/gjson/gjson_z_example_test.go:917–937  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

915}
916
917func ExampleJson_GetJsons() {
918 data := []byte(`
919{
920 "users" : {
921 "count" : 3,
922 "array" : [{"Age":18,"Name":"John"}, {"Age":20,"Name":"Tom"}]
923 }
924 }
925`)
926
927 j, _ := gjson.LoadContent(data)
928
929 jsons := j.GetJsons("users.array")
930 for _, json := range jsons {
931 fmt.Println(json.Interface())
932 }
933
934 // Output:
935 // map[Age:18 Name:John]
936 // map[Age:20 Name:Tom]
937}
938
939func ExampleJson_GetJsonMap() {
940 data := []byte(`

Callers

nothing calls this directly

Calls 3

LoadContentFunction · 0.92
GetJsonsMethod · 0.80
InterfaceMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…