Standard library
JSON
Parse and stringify JSON product values.
Introduction
Parse and stringify JSON product values. Import std/json to bind the module as json. Call free functions as json.name(...). Struct methods use a receiver value.
/ std/json
This page is the package reference for std/json. Private helpers used only by co-located tests are not listed.
Functions
Free functions on json. Each function has a short description, an example, then parameters and return shape.
parse
Parses JSON text into a product value. Call form: json.parse(s).
/ std/json
| json.parse('{"n":1}') {
$ o { }
! e { }
}Parameters: s: JSON text. Returns: Result. Ok arm: parsed value. Err arm: "json parse failed".
stringify
Serializes a product value to JSON text. Call form: json.stringify(v).
/ std/json
| json.stringify({ n: 1 }) {
$ s { }
! e { }
}Parameters: v: product or value to encode. Returns: Result. Ok arm: JSON string. Err arm: "json stringify failed".