package json

import "cuelang.org/go/internal/encoding/json"

Index

Functions

func Encode

func Encode(n ast.Node) (b []byte, err error)

Encode converts a CUE AST to unescaped JSON.

The given file must only contain values that can be directly supported by JSON:

Type          Restrictions
BasicLit
File          no imports, aliases, or definitions
StructLit     no embeddings, aliases, or definitions
List
Field         must be regular; label must be a BasicLit or Ident

Comments and attributes are ignored.

func Marshal

func Marshal(v any) ([]byte, error)

Marshal is a replacement for json.Marshal without HTML escaping.

Source Files

encode.go

Version
v0.8.2
Published
Apr 26, 2024
Platform
js/wasm
Imports
10 packages
Last checked
40 minutes ago

Tools for package owners.