package json
import "cuelang.org/go/encoding/json"
Package json converts JSON to and from CUE.
Index ¶
- func Extract(path string, data []byte) (ast.Expr, error)
- func Valid(b []byte) bool
- func Validate(b []byte, v cue.Value) error
- type Decoder
Functions ¶
func Extract ¶
Extract parses JSON-encoded data to a CUE expression, using path for position information.
func Valid ¶
Valid reports whether data is a valid JSON encoding.
func Validate ¶
Validate validates JSON and confirms it matches the constraints specified by v.
Types ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
A Decoder converts JSON values to CUE.
func NewDecoder ¶
NewDecoder configures a JSON decoder. The path is used to associate position information with each node. The runtime may be nil if the decoder is only used to extract to CUE ast objects.
The runtime argument is a historical remnant and unused.
func (*Decoder) Extract ¶
Extract converts the current JSON value to a CUE ast. It returns io.EOF if the input has been exhausted.
Source Files ¶
json.go
- Version
- v0.12.0 (latest)
- Published
- Jan 30, 2025
- Platform
- linux/amd64
- Imports
- 13 packages
- Last checked
- 8 hours ago –
Tools for package owners.