ribs_json library
A functional JSON library for Dart.
Json is a sealed ADT (JNull, JBoolean, JNumber, JString, JArray, JObject) with support for parsing, formatting via Printer, and streaming via JsonTransformer. Decoder, Encoder, and Codec provide type-safe conversion to and from Dart types, with built-in instances for primitives, enums, and collections; structured types compose via the product syntax on KeyValueCodec. Navigation uses a cursor zipper (HCursor, FailedCursor) that tracks the path through the tree so that DecodingFailure errors carry precise location information.
Classes
- ACursor
- Abstract cursor over a Json tree, providing navigation and decoding.
- ArrayIndex
- A PathElem representing a JSON array element access.
- AsyncParser
- A stateful, incremental JSON parser that accepts data in chunks.
-
Codec<
A> - Bidirectional JSON codec that combines a Decoder and an Encoder.
- CursorOp
- A single step recorded in an ACursor's history.
- CustomReason
- A free-form failure reason supplied by Decoder.emap or Decoder.ensure.
-
Decoder<
A> -
Decodes a Json value (or cursor position) into a Dart type
A. - DecodingFailure
- An error produced when a Decoder cannot produce a value from the focused Json.
- DeleteGoParent
- The focused value was deleted and the cursor moved to the parent.
- DownArray
- Cursor descended into the first element of a JSON array.
- DownField
- Cursor descended into field key of a JSON object.
- DownN
- Cursor descended into element n of a JSON array.
-
Encoder<
A> -
Encodes a Dart value of type
Ainto a Json value. - Error
- Base type for all JSON errors. Subtypes are ParsingFailure and DecodingFailure.
- FailedCursor
- An ACursor representing a failed navigation step.
- Field
- Cursor moved to a sibling field key within the same JSON object.
- HCursor
- A successful ACursor positioned at a Json value.
- JArray
- A JSON array value.
- JBoolean
-
A JSON boolean value (
trueorfalse). - JNull
-
The JSON
nullvalue. - JNumber
- A JSON number value.
- JObject
- A JSON object value.
- Json
- An immutable JSON value.
-
JsonFolder<
A> - Visitor interface for exhaustively processing a Json value.
- JsonObject
- An immutable, ordered JSON object (key-value map).
-
JsonTransformer<
A> -
A StreamTransformer that parses a stream of
Achunks into a stream of Json values using an AsyncParser. - JString
- A JSON string value.
-
KeyCodec<
A> - Bidirectional codec for JsonObject keys, combining KeyDecoder and KeyEncoder into a single type.
-
KeyDecoder<
A> -
Decodes JSON object key strings into values of type
A. -
KeyEncoder<
A> -
Converts values of type
Ato JSON object key strings. -
KeyValueCodec<
A> - A Codec that reads and writes a single JSON object field.
- MissingField
- Indicates that a required field was absent from the JSON object.
- MoveLeft
- Cursor moved left to the previous array element.
- MoveRight
- Cursor moved right to the next array element.
- MoveUp
- Cursor moved up to the parent JSON value.
- ObjectKey
- A PathElem representing a JSON object field access.
- ParsingFailure
- An error produced when the JSON input is syntactically invalid.
- PathElem
- A single element in a PathToRoot: either an object key or an array index.
- PathToRoot
- The sequence of PathElems from the root of a Json tree to the cursor position, used to render a human-readable location in DecodingFailure messages.
- Printer
- Renders a Json value to a formatted String.
- Reason
- Sealed base for the reason a DecodingFailure occurred.
- WrongTypeExpectation
- Indicates that the focused Json value was not of the expected type.
Enums
- AsyncParserMode
- Controls how an AsyncParser interprets its input stream.
Extensions
-
Codec10KVOps
on (KeyValueCodec<
A> , KeyValueCodec<B> , KeyValueCodec<C> , KeyValueCodec<D> , KeyValueCodec<E> , KeyValueCodec<F> , KeyValueCodec<G> , KeyValueCodec<H> , KeyValueCodec<I> , KeyValueCodec<J> ) - Provides a product operation on a 10-tuple of KeyValueCodecs.
-
Codec10Ops
on ((String, Codec<
A> ), (String, Codec<B> ), (String, Codec<C> ), (String, Codec<D> ), (String, Codec<E> ), (String, Codec<F> ), (String, Codec<G> ), (String, Codec<H> ), (String, Codec<I> ), (String, Codec<J> )) - Provides a product operation on a 10-tuple of (String, Codec) pairs.
-
Codec11KVOps
on (KeyValueCodec<
A> , KeyValueCodec<B> , KeyValueCodec<C> , KeyValueCodec<D> , KeyValueCodec<E> , KeyValueCodec<F> , KeyValueCodec<G> , KeyValueCodec<H> , KeyValueCodec<I> , KeyValueCodec<J> , KeyValueCodec<K> ) - Provides a product operation on a 11-tuple of KeyValueCodecs.
-
Codec11Ops
on ((String, Codec<
A> ), (String, Codec<B> ), (String, Codec<C> ), (String, Codec<D> ), (String, Codec<E> ), (String, Codec<F> ), (String, Codec<G> ), (String, Codec<H> ), (String, Codec<I> ), (String, Codec<J> ), (String, Codec<K> )) - Provides a product operation on a 11-tuple of (String, Codec) pairs.
-
Codec12KVOps
on (KeyValueCodec<
A> , KeyValueCodec<B> , KeyValueCodec<C> , KeyValueCodec<D> , KeyValueCodec<E> , KeyValueCodec<F> , KeyValueCodec<G> , KeyValueCodec<H> , KeyValueCodec<I> , KeyValueCodec<J> , KeyValueCodec<K> , KeyValueCodec<L> ) - Provides a product operation on a 12-tuple of KeyValueCodecs.
-
Codec12Ops
on ((String, Codec<
A> ), (String, Codec<B> ), (String, Codec<C> ), (String, Codec<D> ), (String, Codec<E> ), (String, Codec<F> ), (String, Codec<G> ), (String, Codec<H> ), (String, Codec<I> ), (String, Codec<J> ), (String, Codec<K> ), (String, Codec<L> )) - Provides a product operation on a 12-tuple of (String, Codec) pairs.
-
Codec13KVOps
on (KeyValueCodec<
A> , KeyValueCodec<B> , KeyValueCodec<C> , KeyValueCodec<D> , KeyValueCodec<E> , KeyValueCodec<F> , KeyValueCodec<G> , KeyValueCodec<H> , KeyValueCodec<I> , KeyValueCodec<J> , KeyValueCodec<K> , KeyValueCodec<L> , KeyValueCodec<M> ) - Provides a product operation on a 13-tuple of KeyValueCodecs.
-
Codec13Ops
on ((String, Codec<
A> ), (String, Codec<B> ), (String, Codec<C> ), (String, Codec<D> ), (String, Codec<E> ), (String, Codec<F> ), (String, Codec<G> ), (String, Codec<H> ), (String, Codec<I> ), (String, Codec<J> ), (String, Codec<K> ), (String, Codec<L> ), (String, Codec<M> )) - Provides a product operation on a 13-tuple of (String, Codec) pairs.
-
Codec14KVOps
on (KeyValueCodec<
A> , KeyValueCodec<B> , KeyValueCodec<C> , KeyValueCodec<D> , KeyValueCodec<E> , KeyValueCodec<F> , KeyValueCodec<G> , KeyValueCodec<H> , KeyValueCodec<I> , KeyValueCodec<J> , KeyValueCodec<K> , KeyValueCodec<L> , KeyValueCodec<M> , KeyValueCodec<N> ) - Provides a product operation on a 14-tuple of KeyValueCodecs.
-
Codec14Ops
on ((String, Codec<
A> ), (String, Codec<B> ), (String, Codec<C> ), (String, Codec<D> ), (String, Codec<E> ), (String, Codec<F> ), (String, Codec<G> ), (String, Codec<H> ), (String, Codec<I> ), (String, Codec<J> ), (String, Codec<K> ), (String, Codec<L> ), (String, Codec<M> ), (String, Codec<N> )) - Provides a product operation on a 14-tuple of (String, Codec) pairs.
-
Codec15KVOps
on (KeyValueCodec<
A> , KeyValueCodec<B> , KeyValueCodec<C> , KeyValueCodec<D> , KeyValueCodec<E> , KeyValueCodec<F> , KeyValueCodec<G> , KeyValueCodec<H> , KeyValueCodec<I> , KeyValueCodec<J> , KeyValueCodec<K> , KeyValueCodec<L> , KeyValueCodec<M> , KeyValueCodec<N> , KeyValueCodec<O> ) - Provides a product operation on a 15-tuple of KeyValueCodecs.
-
Codec15Ops
on ((String, Codec<
A> ), (String, Codec<B> ), (String, Codec<C> ), (String, Codec<D> ), (String, Codec<E> ), (String, Codec<F> ), (String, Codec<G> ), (String, Codec<H> ), (String, Codec<I> ), (String, Codec<J> ), (String, Codec<K> ), (String, Codec<L> ), (String, Codec<M> ), (String, Codec<N> ), (String, Codec<O> )) - Provides a product operation on a 15-tuple of (String, Codec) pairs.
-
Codec16KVOps
on (KeyValueCodec<
A> , KeyValueCodec<B> , KeyValueCodec<C> , KeyValueCodec<D> , KeyValueCodec<E> , KeyValueCodec<F> , KeyValueCodec<G> , KeyValueCodec<H> , KeyValueCodec<I> , KeyValueCodec<J> , KeyValueCodec<K> , KeyValueCodec<L> , KeyValueCodec<M> , KeyValueCodec<N> , KeyValueCodec<O> , KeyValueCodec<P> ) - Provides a product operation on a 16-tuple of KeyValueCodecs.
-
Codec16Ops
on ((String, Codec<
A> ), (String, Codec<B> ), (String, Codec<C> ), (String, Codec<D> ), (String, Codec<E> ), (String, Codec<F> ), (String, Codec<G> ), (String, Codec<H> ), (String, Codec<I> ), (String, Codec<J> ), (String, Codec<K> ), (String, Codec<L> ), (String, Codec<M> ), (String, Codec<N> ), (String, Codec<O> ), (String, Codec<P> )) - Provides a product operation on a 16-tuple of (String, Codec) pairs.
-
Codec17KVOps
on (KeyValueCodec<
A> , KeyValueCodec<B> , KeyValueCodec<C> , KeyValueCodec<D> , KeyValueCodec<E> , KeyValueCodec<F> , KeyValueCodec<G> , KeyValueCodec<H> , KeyValueCodec<I> , KeyValueCodec<J> , KeyValueCodec<K> , KeyValueCodec<L> , KeyValueCodec<M> , KeyValueCodec<N> , KeyValueCodec<O> , KeyValueCodec<P> , KeyValueCodec<Q> ) - Provides a product operation on a 17-tuple of KeyValueCodecs.
-
Codec17Ops
on ((String, Codec<
A> ), (String, Codec<B> ), (String, Codec<C> ), (String, Codec<D> ), (String, Codec<E> ), (String, Codec<F> ), (String, Codec<G> ), (String, Codec<H> ), (String, Codec<I> ), (String, Codec<J> ), (String, Codec<K> ), (String, Codec<L> ), (String, Codec<M> ), (String, Codec<N> ), (String, Codec<O> ), (String, Codec<P> ), (String, Codec<Q> )) - Provides a product operation on a 17-tuple of (String, Codec) pairs.
-
Codec18KVOps
on (KeyValueCodec<
A> , KeyValueCodec<B> , KeyValueCodec<C> , KeyValueCodec<D> , KeyValueCodec<E> , KeyValueCodec<F> , KeyValueCodec<G> , KeyValueCodec<H> , KeyValueCodec<I> , KeyValueCodec<J> , KeyValueCodec<K> , KeyValueCodec<L> , KeyValueCodec<M> , KeyValueCodec<N> , KeyValueCodec<O> , KeyValueCodec<P> , KeyValueCodec<Q> , KeyValueCodec<R> ) - Provides a product operation on a 18-tuple of KeyValueCodecs.
-
Codec18Ops
on ((String, Codec<
A> ), (String, Codec<B> ), (String, Codec<C> ), (String, Codec<D> ), (String, Codec<E> ), (String, Codec<F> ), (String, Codec<G> ), (String, Codec<H> ), (String, Codec<I> ), (String, Codec<J> ), (String, Codec<K> ), (String, Codec<L> ), (String, Codec<M> ), (String, Codec<N> ), (String, Codec<O> ), (String, Codec<P> ), (String, Codec<Q> ), (String, Codec<R> )) - Provides a product operation on a 18-tuple of (String, Codec) pairs.
-
Codec19KVOps
on (KeyValueCodec<
A> , KeyValueCodec<B> , KeyValueCodec<C> , KeyValueCodec<D> , KeyValueCodec<E> , KeyValueCodec<F> , KeyValueCodec<G> , KeyValueCodec<H> , KeyValueCodec<I> , KeyValueCodec<J> , KeyValueCodec<K> , KeyValueCodec<L> , KeyValueCodec<M> , KeyValueCodec<N> , KeyValueCodec<O> , KeyValueCodec<P> , KeyValueCodec<Q> , KeyValueCodec<R> , KeyValueCodec<S> ) - Provides a product operation on a 19-tuple of KeyValueCodecs.
-
Codec19Ops
on ((String, Codec<
A> ), (String, Codec<B> ), (String, Codec<C> ), (String, Codec<D> ), (String, Codec<E> ), (String, Codec<F> ), (String, Codec<G> ), (String, Codec<H> ), (String, Codec<I> ), (String, Codec<J> ), (String, Codec<K> ), (String, Codec<L> ), (String, Codec<M> ), (String, Codec<N> ), (String, Codec<O> ), (String, Codec<P> ), (String, Codec<Q> ), (String, Codec<R> ), (String, Codec<S> )) - Provides a product operation on a 19-tuple of (String, Codec) pairs.
-
Codec20KVOps
on (KeyValueCodec<
A> , KeyValueCodec<B> , KeyValueCodec<C> , KeyValueCodec<D> , KeyValueCodec<E> , KeyValueCodec<F> , KeyValueCodec<G> , KeyValueCodec<H> , KeyValueCodec<I> , KeyValueCodec<J> , KeyValueCodec<K> , KeyValueCodec<L> , KeyValueCodec<M> , KeyValueCodec<N> , KeyValueCodec<O> , KeyValueCodec<P> , KeyValueCodec<Q> , KeyValueCodec<R> , KeyValueCodec<S> , KeyValueCodec<T> ) - Provides a product operation on a 20-tuple of KeyValueCodecs.
-
Codec20Ops
on ((String, Codec<
A> ), (String, Codec<B> ), (String, Codec<C> ), (String, Codec<D> ), (String, Codec<E> ), (String, Codec<F> ), (String, Codec<G> ), (String, Codec<H> ), (String, Codec<I> ), (String, Codec<J> ), (String, Codec<K> ), (String, Codec<L> ), (String, Codec<M> ), (String, Codec<N> ), (String, Codec<O> ), (String, Codec<P> ), (String, Codec<Q> ), (String, Codec<R> ), (String, Codec<S> ), (String, Codec<T> )) - Provides a product operation on a 20-tuple of (String, Codec) pairs.
-
Codec21KVOps
on (KeyValueCodec<
A> , KeyValueCodec<B> , KeyValueCodec<C> , KeyValueCodec<D> , KeyValueCodec<E> , KeyValueCodec<F> , KeyValueCodec<G> , KeyValueCodec<H> , KeyValueCodec<I> , KeyValueCodec<J> , KeyValueCodec<K> , KeyValueCodec<L> , KeyValueCodec<M> , KeyValueCodec<N> , KeyValueCodec<O> , KeyValueCodec<P> , KeyValueCodec<Q> , KeyValueCodec<R> , KeyValueCodec<S> , KeyValueCodec<T> , KeyValueCodec<U> ) - Provides a product operation on a 21-tuple of KeyValueCodecs.
-
Codec21Ops
on ((String, Codec<
A> ), (String, Codec<B> ), (String, Codec<C> ), (String, Codec<D> ), (String, Codec<E> ), (String, Codec<F> ), (String, Codec<G> ), (String, Codec<H> ), (String, Codec<I> ), (String, Codec<J> ), (String, Codec<K> ), (String, Codec<L> ), (String, Codec<M> ), (String, Codec<N> ), (String, Codec<O> ), (String, Codec<P> ), (String, Codec<Q> ), (String, Codec<R> ), (String, Codec<S> ), (String, Codec<T> ), (String, Codec<U> )) - Provides a product operation on a 21-tuple of (String, Codec) pairs.
-
Codec22KVOps
on (KeyValueCodec<
A> , KeyValueCodec<B> , KeyValueCodec<C> , KeyValueCodec<D> , KeyValueCodec<E> , KeyValueCodec<F> , KeyValueCodec<G> , KeyValueCodec<H> , KeyValueCodec<I> , KeyValueCodec<J> , KeyValueCodec<K> , KeyValueCodec<L> , KeyValueCodec<M> , KeyValueCodec<N> , KeyValueCodec<O> , KeyValueCodec<P> , KeyValueCodec<Q> , KeyValueCodec<R> , KeyValueCodec<S> , KeyValueCodec<T> , KeyValueCodec<U> , KeyValueCodec<V> ) - Provides a product operation on a 22-tuple of KeyValueCodecs.
-
Codec22Ops
on ((String, Codec<
A> ), (String, Codec<B> ), (String, Codec<C> ), (String, Codec<D> ), (String, Codec<E> ), (String, Codec<F> ), (String, Codec<G> ), (String, Codec<H> ), (String, Codec<I> ), (String, Codec<J> ), (String, Codec<K> ), (String, Codec<L> ), (String, Codec<M> ), (String, Codec<N> ), (String, Codec<O> ), (String, Codec<P> ), (String, Codec<Q> ), (String, Codec<R> ), (String, Codec<S> ), (String, Codec<T> ), (String, Codec<U> ), (String, Codec<V> )) - Provides a product operation on a 22-tuple of (String, Codec) pairs.
-
Codec2KVOps
on (KeyValueCodec<
A> , KeyValueCodec<B> ) - Provides a product operation on a 2-tuple of KeyValueCodecs.
-
Codec2Ops
on ((String, Codec<
A> ), (String, Codec<B> )) - Provides a product operation on a 2-tuple of (String, Codec) pairs.
-
Codec3KVOps
on (KeyValueCodec<
A> , KeyValueCodec<B> , KeyValueCodec<C> ) - Provides a product operation on a 3-tuple of KeyValueCodecs.
-
Codec3Ops
on ((String, Codec<
A> ), (String, Codec<B> ), (String, Codec<C> )) - Provides a product operation on a 3-tuple of (String, Codec) pairs.
-
Codec4KVOps
on (KeyValueCodec<
A> , KeyValueCodec<B> , KeyValueCodec<C> , KeyValueCodec<D> ) - Provides a product operation on a 4-tuple of KeyValueCodecs.
-
Codec4Ops
on ((String, Codec<
A> ), (String, Codec<B> ), (String, Codec<C> ), (String, Codec<D> )) - Provides a product operation on a 4-tuple of (String, Codec) pairs.
-
Codec5KVOps
on (KeyValueCodec<
A> , KeyValueCodec<B> , KeyValueCodec<C> , KeyValueCodec<D> , KeyValueCodec<E> ) - Provides a product operation on a 5-tuple of KeyValueCodecs.
-
Codec5Ops
on ((String, Codec<
A> ), (String, Codec<B> ), (String, Codec<C> ), (String, Codec<D> ), (String, Codec<E> )) - Provides a product operation on a 5-tuple of (String, Codec) pairs.
-
Codec6KVOps
on (KeyValueCodec<
A> , KeyValueCodec<B> , KeyValueCodec<C> , KeyValueCodec<D> , KeyValueCodec<E> , KeyValueCodec<F> ) - Provides a product operation on a 6-tuple of KeyValueCodecs.
-
Codec6Ops
on ((String, Codec<
A> ), (String, Codec<B> ), (String, Codec<C> ), (String, Codec<D> ), (String, Codec<E> ), (String, Codec<F> )) - Provides a product operation on a 6-tuple of (String, Codec) pairs.
-
Codec7KVOps
on (KeyValueCodec<
A> , KeyValueCodec<B> , KeyValueCodec<C> , KeyValueCodec<D> , KeyValueCodec<E> , KeyValueCodec<F> , KeyValueCodec<G> ) - Provides a product operation on a 7-tuple of KeyValueCodecs.
-
Codec7Ops
on ((String, Codec<
A> ), (String, Codec<B> ), (String, Codec<C> ), (String, Codec<D> ), (String, Codec<E> ), (String, Codec<F> ), (String, Codec<G> )) - Provides a product operation on a 7-tuple of (String, Codec) pairs.
-
Codec8KVOps
on (KeyValueCodec<
A> , KeyValueCodec<B> , KeyValueCodec<C> , KeyValueCodec<D> , KeyValueCodec<E> , KeyValueCodec<F> , KeyValueCodec<G> , KeyValueCodec<H> ) - Provides a product operation on a 8-tuple of KeyValueCodecs.
-
Codec8Ops
on ((String, Codec<
A> ), (String, Codec<B> ), (String, Codec<C> ), (String, Codec<D> ), (String, Codec<E> ), (String, Codec<F> ), (String, Codec<G> ), (String, Codec<H> )) - Provides a product operation on a 8-tuple of (String, Codec) pairs.
-
Codec9KVOps
on (KeyValueCodec<
A> , KeyValueCodec<B> , KeyValueCodec<C> , KeyValueCodec<D> , KeyValueCodec<E> , KeyValueCodec<F> , KeyValueCodec<G> , KeyValueCodec<H> , KeyValueCodec<I> ) - Provides a product operation on a 9-tuple of KeyValueCodecs.
-
Codec9Ops
on ((String, Codec<
A> ), (String, Codec<B> ), (String, Codec<C> ), (String, Codec<D> ), (String, Codec<E> ), (String, Codec<F> ), (String, Codec<G> ), (String, Codec<H> ), (String, Codec<I> )) - Provides a product operation on a 9-tuple of (String, Codec) pairs.
- KeyValueCodecOps on String
- Syntax for creating KeyValueCodec instances from a field-name string.
Typedefs
-
DecodeResult<
A> = Either< DecodingFailure, A> -
The result of a Decoder: either a DecodingFailure or a value of
A.
Exceptions / Errors
- AsyncException
- Internal sentinel thrown when AsyncParser runs out of buffered data mid-parse; caught and handled by AsyncParser itself.