glendix/js/json

Serializes and parses typed gleam/json values in JavaScript.

Types

Represents a JSON parsing failure while preserving the JavaScript reason.

pub type JsonError {
  InvalidJson(reason: String)
}

Constructors

  • InvalidJson(reason: String)

    JavaScript rejected the supplied JSON text.

Values

pub fn parse(from source: String) -> Result(json.Json, JsonError)

Parses JSON text into a typed JSON value.

pub fn stringify(value value: json.Json) -> String

Serializes a JSON value.

Search Document