json
v0.1.2
go.neonxp.dev/json
Documentation
pkg.go.dev ↗Types
AcceptParent
type AcceptParent interface {
SetParent(n Node)
}
ArrayNode
type ArrayNode interface {
Node
Append(v Node)
Index(i int) Node
Len() int
}
BooleanNode
type BooleanNode interface {
Node
}
Factory
type Factory interface {
Produce(typ NodeType) (Node, error)
Fill(n Node, value any)
}
JSON
type JSON struct {
Factory Factory
}
New
func New(factory Factory) *JSON
JSON.Marshal
func (j *JSON) Marshal(n Node) string
JSON.MustNode
func (j *JSON) MustNode(value any) Node
JSON.MustUnmarshal
func (j *JSON) MustUnmarshal(input string) Node
JSON.Node
func (j *JSON) Node(value any) (Node, error)
JSON.Unmarshal
func (j *JSON) Unmarshal(input string) (Node, error)
Node
type Node interface {
ToJSON() string
}
MustQuery
func MustQuery(parent Node, path []string) Node
Query
func Query(parent Node, path []string) (Node, error)
NodeType
type NodeType string
StringType (6 declarations)
const ( StringType NodeType = "string" NumberType NodeType = "number" ObjectType NodeType = "object" ArrayType NodeType = "array" BooleanType NodeType = "boolean" NullType NodeType = "null" )
NullNode
type NullNode interface {
Node
}
NumberNode
type NumberNode interface {
Node
}
ObjectNode
type ObjectNode interface {
Node
Set(k string, v Node)
Get(k string) (Node, bool)
}
StringNode
type StringNode interface {
Node
}