MCPcopy Index your code
hub / github.com/valyala/fastjson / ExampleValue_GetStringBytes

Function ExampleValue_GetStringBytes

parser_example_test.go:184–205  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

182}
183
184func ExampleValue_GetStringBytes() {
185 s := `[
186 {"foo": "bar"},
187 [123, "baz"]
188 ]`
189
190 var p fastjson.Parser
191 v, err := p.Parse(s)
192 if err != nil {
193 log.Fatalf("cannot parse json: %s", err)
194 }
195 fmt.Printf("v[0].foo = %q\n", v.GetStringBytes("0", "foo"))
196 fmt.Printf("v[1][1] = %q\n", v.GetStringBytes("1", "1"))
197 fmt.Printf("v[1][0] = %q\n", v.GetStringBytes("1", "0"))
198 fmt.Printf("v.foo.bar.baz = %q\n", v.GetStringBytes("foo", "bar", "baz"))
199
200 // Output:
201 // v[0].foo = "bar"
202 // v[1][1] = "baz"
203 // v[1][0] = ""
204 // v.foo.bar.baz = ""
205}

Callers

nothing calls this directly

Calls 2

ParseMethod · 0.95
GetStringBytesMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…