Sign in

    moonrockz/openrpc/json does not have a README file

    Code

    pub(all) enum Code {
    Syntax
    DuplicateKey
    LimitExceeded
    InvalidNumber
    InvalidReference
    UnresolvedReference
    WrongType
    MissingField
    UnsupportedVersion
    UnsupportedDialect
    UnsupportedCheck
    InvalidSchema
    ParameterOrder
    MissingBaseUri
    UnavailableResource
    ConflictingIdentifier
    ReferenceCycle
    DuplicateName
    DuplicateErrorCode
    UnknownMethod
    UnknownField
    InvalidValue
    StaleNode
    } derive(Eq,
    Debug
    )

    Code::equal

    fn Code::equal(Code, Code) -> Bool

    Code::not_equal

    fn Code::not_equal(x : Code, y : Code) -> Bool

    Code::to_repr

    CstDocument

    pub struct CstDocument {
    source : String
    source_id : String?
    nodes : Array[Node]
    limits : Limits
    } derive(
    Debug
    )

    CstDocument::limits

    fn CstDocument::limits(self : CstDocument) -> Limits

    CstDocument::lower

    fn CstDocument::lower(self : CstDocument) -> Result[Value, Array[Diagnostic]]

    CstDocument::node_at

    fn CstDocument::node_at(self : CstDocument, path : Array[String]) -> NodeId?

    The first node at a structured path. Duplicate names have several nodes; SourceMap::locations lists them all.

    CstDocument::node_id

    fn CstDocument::node_id(self : CstDocument, index : Int) -> NodeId?

    CstDocument::nodes

    fn CstDocument::nodes(self : CstDocument) -> Array[Node]

    CstDocument::path

    fn CstDocument::path(self : CstDocument, index : Int) -> Array[String]?

    CstDocument::replace_value

    fn CstDocument::replace_value(self : CstDocument, node : NodeId, value : Value, limits? : Limits) -> Result[CstDocument, Diagnostic]

    Replace the value at node with the compact encoding of value and parse the result. Every code unit outside the value's span is kept, including a member's key and the whitespace around it. The original CST is unchanged.

    CstDocument::reproduce

    fn CstDocument::reproduce(self : CstDocument) -> String

    CstDocument::slice

    fn CstDocument::slice(self : CstDocument, span : Span) -> String?

    CstDocument::source_id

    fn CstDocument::source_id(self : CstDocument) -> String?

    CstDocument::source_map

    fn CstDocument::source_map(self : CstDocument) -> SourceMap

    CstDocument::span_at

    fn CstDocument::span_at(self : CstDocument, path : Array[String]) -> Span?

    CstDocument::tokens

    fn CstDocument::tokens(self : CstDocument) -> Array[Token]

    Tokenize the already-checked source, including every trivia occurrence.

    Diagnostic

    pub struct Diagnostic {
    code : Code
    message : String
    path : Array[String]
    span : Span?
    related : Array[Span]
    } derive(
    Debug
    )

    Diagnostic::code

    fn Diagnostic::code(self : Diagnostic) -> Code

    Diagnostic::message

    fn Diagnostic::message(self : Diagnostic) -> String

    Diagnostic::new

    fn Diagnostic::new(code : Code, message : String, path? : Array[String], span? : Span?, related? : Array[Span]) -> Diagnostic

    Diagnostic::path

    fn Diagnostic::path(self : Diagnostic) -> Array[String]

    Diagnostic::related

    fn Diagnostic::related(self : Diagnostic) -> Array[Span]

    Diagnostic::span

    fn Diagnostic::span(self : Diagnostic) -> Span?

    Format

    pub(all) enum Format {
    Compact
    Pretty
    } derive(Eq,
    Debug
    )

    Output layout. Compact is canonical; Pretty adds two-space indentation and changes nothing else.

    Format::equal

    fn Format::equal(Format, Format) -> Bool

    Format::not_equal

    fn Format::not_equal(x : Format, y : Format) -> Bool

    Format::to_repr

    Kind

    pub(all) enum Kind {
    Null
    Boolean(Bool)
    String(String)
    Numeric(Number)
    Array(Array[Value])
    Object(Array[(String, Value)])
    } derive(
    Debug
    )

    Kind::to_repr

    Limits

    pub struct Limits {
    max_depth : Int
    max_nodes : Int
    max_source : Int
    max_number : Int
    max_findings : Int
    } derive(
    Debug
    )

    Limits::max_depth

    fn Limits::max_depth(self : Limits) -> Int

    Limits::max_findings

    fn Limits::max_findings(self : Limits) -> Int

    Limits::max_nodes

    fn Limits::max_nodes(self : Limits) -> Int

    Limits::max_number

    fn Limits::max_number(self : Limits) -> Int

    Limits::max_source

    fn Limits::max_source(self : Limits) -> Int

    Limits::new

    fn Limits::new(max_depth? : Int, max_nodes? : Int, max_source? : Int, max_number? : Int, max_findings? : Int) -> Limits

    Limits::to_repr

    Limits::unlimited

    fn Limits::unlimited() -> Limits

    Remove policy bounds within the maximum representable String/Array sizes. This does not guarantee available host memory.

    Location

    pub struct Location {
    source_id : String?
    node_index : Int
    value_span : Span
    key_span : Span?
    // private fields
    } derive(
    Debug
    )

    Location::key_span

    fn Location::key_span(self : Location) -> Span?

    Location::node

    fn Location::node(self : Location) -> NodeId

    The node as a handle that CstDocument::replace_value accepts.

    Location::node_index

    fn Location::node_index(self : Location) -> Int

    Index into the owning CST only. It is not stable across parses or edits.

    Location::source_id

    fn Location::source_id(self : Location) -> String?

    Location::to_repr

    Location::value_span

    fn Location::value_span(self : Location) -> Span

    Node

    pub struct Node {
    kind : NodeKind
    span : Span
    key : String?
    key_span : Span?
    children : Array[Int]
    scalar : Value?
    parent : Int?
    ordinal : Int
    } derive(
    Debug
    )

    Node::children

    fn Node::children(self : Node) -> Array[Int]

    Node::key

    fn Node::key(self : Node) -> String?

    Node::key_span

    fn Node::key_span(self : Node) -> Span?

    Node::kind

    fn Node::kind(self : Node) -> NodeKind

    Node::span

    fn Node::span(self : Node) -> Span

    Node::to_repr

    NodeId

    pub struct NodeId {
    // private fields
    }

    A handle to one CST node. It is valid only for a CST with exactly the same source text as the parse that produced it.

    NodeId::index

    fn NodeId::index(self : NodeId) -> Int

    NodeId::to_repr

    NodeKind

    pub(all) enum NodeKind {
    Scalar
    ArrayNode
    ObjectNode
    } derive(Eq,
    Debug
    )

    NodeKind::equal

    fn NodeKind::equal(NodeKind, NodeKind) -> Bool

    NodeKind::not_equal

    fn NodeKind::not_equal(x : NodeKind, y : NodeKind) -> Bool

    NodeKind::to_repr

    Number

    pub struct Number {
    token : String
    } derive(Eq,
    Debug
    )

    Number::equal

    fn Number::equal(Number, Number) -> Bool

    Number::is_integer

    fn Number::is_integer(self : Number) -> Bool

    Number::not_equal

    fn Number::not_equal(x : Number, y : Number) -> Bool

    Number::numeric_compare

    fn Number::numeric_compare(self : Number, other : Number) -> Int

    Compare mathematical values without converting to binary floating point.

    Number::numeric_equal

    fn Number::numeric_equal(self : Number, other : Number) -> Bool

    Number::numeric_key

    fn Number::numeric_key(self : Number) -> String

    A key that is equal exactly when the numbers are numerically equal, for hashing many values without pairwise comparison.

    Number::parse

    fn Number::parse(token : String) -> Result[Number, Diagnostic]

    Number::to_repr

    Number::token

    fn Number::token(self : Number) -> String

    Position

    pub struct Position {
    line : Int
    column : Int
    } derive(Eq,
    Debug
    )

    Position::column

    fn Position::column(self : Position) -> Int

    Position::equal

    fn Position::equal(Position, Position) -> Bool

    Position::line

    fn Position::line(self : Position) -> Int

    Position::not_equal

    fn Position::not_equal(x : Position, y : Position) -> Bool

    Position::to_repr

    SourceMap

    pub struct SourceMap {
    cst : CstDocument
    line_starts : Array[Int]
    } derive(
    Debug
    )

    SourceMap::locations

    fn SourceMap::locations(self : SourceMap, path : Array[String]) -> Array[Location]

    Return all occurrences. Duplicate object names have no implicit winner.

    SourceMap::position

    fn SourceMap::position(self : SourceMap, offset : Int) -> Position?

    Span

    pub struct Span {
    start : Int
    end : Int
    } derive(Eq,
    Debug
    )

    Span::end

    fn Span::end(self : Span) -> Int

    Span::equal

    fn Span::equal(Span, Span) -> Bool

    Span::new

    fn Span::new(start : Int, end : Int) -> Span?

    Span::not_equal

    fn Span::not_equal(x : Span, y : Span) -> Bool

    Span::start

    fn Span::start(self : Span) -> Int

    Span::to_repr

    Token

    pub struct Token {
    kind : TokenKind
    span : Span
    text : String
    } derive(
    Debug
    )

    Token::kind

    fn Token::kind(self : Token) -> TokenKind

    Token::span

    fn Token::span(self : Token) -> Span

    Token::text

    fn Token::text(self : Token) -> String

    Token::to_repr

    TokenKind

    pub(all) enum TokenKind {
    Whitespace
    OpenObject
    CloseObject
    OpenArray
    CloseArray
    Colon
    Comma
    StringToken
    NumberToken
    TrueToken
    FalseToken
    NullToken
    } derive(Eq,
    Debug
    )

    TokenKind::equal

    fn TokenKind::equal(TokenKind, TokenKind) -> Bool

    TokenKind::not_equal

    fn TokenKind::not_equal(x : TokenKind, y : TokenKind) -> Bool

    Value

    pub struct Value {
    // private fields
    } derive(
    Debug
    )

    Value::array

    fn Value::array(items : Array[Value]) -> Value

    Value::array_item

    fn Value::array_item(self : Value, index : Int) -> Value?

    Return an immutable array child, or None for a non-array or missing index.

    Value::array_length

    fn Value::array_length(self : Value) -> Int?

    Inspect array size without creating a copied collection view.

    Value::boolean

    fn Value::boolean(value : Bool) -> Value

    Value::equals

    fn Value::equals(self : Value, other : Value, numeric? : Bool, limits? : Limits) -> Result[Bool, Diagnostic]

    Compare decoded JSON values. Object member order is insignificant. Numeric token spelling is significant unless numeric is selected.

    Value::get

    fn Value::get(self : Value, name : String) -> Value?

    Value::kind

    fn Value::kind(self : Value) -> Kind

    Value::null

    fn Value::null() -> Value

    Value::number

    fn Value::number(value : Number) -> Value

    Value::object

    fn Value::object(fields : Array[(String, Value)]) -> Result[Value, Diagnostic]

    Value::string

    fn Value::string(value : String) -> Value

    Value::text

    fn Value::text(self : Value) -> String?

    Value::to_repr

    from_core_json

    fn from_core_json(value : Json, limits? : Limits) -> Result[Value, Diagnostic]

    Capture the representation the caller's core Json still has. Missing original numeric digits cannot be recovered.

    parse

    fn parse(source : String, source_id? : String?, limits? : Limits) -> Result[CstDocument, Diagnostic]

    to_core_json

    fn to_core_json(value : Value, limits? : Limits) -> Result[Json, Diagnostic]

    Set core numeric repr explicitly. Core arithmetic/equality still use Double.

    write

    fn write(value : Value, format? : Format, limits? : Limits) -> Result[String, Diagnostic]

    Deterministic JSON text: object keys by UTF-16 code units, exact number tokens, array order kept, no final newline. Pretty only adds layout.

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io