For scenarios where you only need specific parts of a JSON document, combine Get() with Unmarshal() or use ast.Node as a generic container instead of map or interface{}. ast.Node uses an array-based storage that is more efficient for insertion and scanning than maps, and it supports lazy loading (parsing values only on demand).
Concurrency Note: ast.Node is not inherently thread-safe due to its lazy loading design. To use a node concurrently, you must call Node.Load() or Node.LoadAll() first.
import "github.com/bytedance/sonic"
// Example: Combining Get and Unmarshal for partial schema
node, err := sonic.GetFromString(_TwitterJson, "statuses", 3, "user")
var user User
err = sonic.UnmarshalString(node.Raw(), &user)
// Example: Using ast.Node as a generic container
root, err := sonic.GetFromString(_TwitterJson)
user := root.GetByPath("statuses", 3, "user")
err = user.Check()
// err = user.LoadAll() // Call this to make 'user' safe for concurrent use
go someFunc(user)