MCPcopy Create free account
hub / github.com/buger/jsonparser / GetUnsafeString

Function GetUnsafeString

parser.go:2028–2036  ·  view source on GitHub ↗

SYS-REQ-011, SYS-REQ-080, SYS-REQ-081, SYS-REQ-082 GetUnsafeString returns the value retrieved by `Get`, use creates string without memory allocation by mapping string to slice memory. It does not handle escape symbols.

(data []byte, keys ...string)

Source from the content-addressed store, hash-verified

2026// SYS-REQ-011, SYS-REQ-080, SYS-REQ-081, SYS-REQ-082
2027// GetUnsafeString returns the value retrieved by `Get`, use creates string without memory allocation by mapping string to slice memory. It does not handle escape symbols.
2028func GetUnsafeString(data []byte, keys ...string) (val string, err error) {
2029 v, _, _, e := Get(data, keys...)
2030
2031 if e != nil {
2032 return "", e
2033 }
2034
2035 return bytesToString(&v), nil
2036}
2037
2038// SYS-REQ-002, SYS-REQ-071, SYS-REQ-072, SYS-REQ-073, SYS-REQ-074
2039// GetString returns the value retrieved by `Get`, cast to a string if possible, trying to properly handle escape and utf8 symbols

Calls 2

GetFunction · 0.85
bytesToStringFunction · 0.70