ribs_json
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
| Class | Description |
|---|---|
| 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 A into 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 (true or false). |
| JNull | The JSON null value. |
| 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 A chunks 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 A to 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. |
Exceptions
| Exception | Description |
|---|---|
| AsyncException | Internal sentinel thrown when AsyncParser runs out of buffered data mid-parse; caught and handled by AsyncParser itself. |
Enums
| Enum | Description |
|---|---|
| AsyncParserMode | Controls how an AsyncParser interprets its input stream. |
Extensions
| Extension | on | Description |
|---|---|---|
| Codec10KVOps<A, B, C, D, E, F, G, H, I, J> | Record | Provides a product operation on a 10-tuple of KeyValueCodecs. |
| Codec10Ops<A, B, C, D, E, F, G, H, I, J> | Record | Provides a product operation on a 10-tuple of (String, Codec) pairs. |
| Codec11KVOps<A, B, C, D, E, F, G, H, I, J, K> | Record | Provides a product operation on a 11-tuple of KeyValueCodecs. |
| Codec11Ops<A, B, C, D, E, F, G, H, I, J, K> | Record | Provides a product operation on a 11-tuple of (String, Codec) pairs. |
| Codec12KVOps<A, B, C, D, E, F, G, H, I, J, K, L> | Record | Provides a product operation on a 12-tuple of KeyValueCodecs. |
| Codec12Ops<A, B, C, D, E, F, G, H, I, J, K, L> | Record | Provides a product operation on a 12-tuple of (String, Codec) pairs. |
| Codec13KVOps<A, B, C, D, E, F, G, H, I, J, K, L, M> | Record | Provides a product operation on a 13-tuple of KeyValueCodecs. |
| Codec13Ops<A, B, C, D, E, F, G, H, I, J, K, L, M> | Record | Provides a product operation on a 13-tuple of (String, Codec) pairs. |
| Codec14KVOps<A, B, C, D, E, F, G, H, I, J, K, L, M, N> | Record | Provides a product operation on a 14-tuple of KeyValueCodecs. |
| Codec14Ops<A, B, C, D, E, F, G, H, I, J, K, L, M, N> | Record | Provides a product operation on a 14-tuple of (String, Codec) pairs. |
| Codec15KVOps<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O> | Record | Provides a product operation on a 15-tuple of KeyValueCodecs. |
| Codec15Ops<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O> | Record | Provides a product operation on a 15-tuple of (String, Codec) pairs. |
| Codec16KVOps<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P> | Record | Provides a product operation on a 16-tuple of KeyValueCodecs. |
| Codec16Ops<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P> | Record | Provides a product operation on a 16-tuple of (String, Codec) pairs. |
| Codec17KVOps<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q> | Record | Provides a product operation on a 17-tuple of KeyValueCodecs. |
| Codec17Ops<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q> | Record | Provides a product operation on a 17-tuple of (String, Codec) pairs. |
| Codec18KVOps<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R> | Record | Provides a product operation on a 18-tuple of KeyValueCodecs. |
| Codec18Ops<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R> | Record | Provides a product operation on a 18-tuple of (String, Codec) pairs. |
| Codec19KVOps<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S> | Record | Provides a product operation on a 19-tuple of KeyValueCodecs. |
| Codec19Ops<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S> | Record | Provides a product operation on a 19-tuple of (String, Codec) pairs. |
| Codec20KVOps<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T> | Record | Provides a product operation on a 20-tuple of KeyValueCodecs. |
| Codec20Ops<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T> | Record | Provides a product operation on a 20-tuple of (String, Codec) pairs. |
| Codec21KVOps<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U> | Record | Provides a product operation on a 21-tuple of KeyValueCodecs. |
| Codec21Ops<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U> | Record | Provides a product operation on a 21-tuple of (String, Codec) pairs. |
| Codec22KVOps<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V> | Record | Provides a product operation on a 22-tuple of KeyValueCodecs. |
| Codec22Ops<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V> | Record | Provides a product operation on a 22-tuple of (String, Codec) pairs. |
| Codec2KVOps<A, B> | Record | Provides a product operation on a 2-tuple of KeyValueCodecs. |
| Codec2Ops<A, B> | Record | Provides a product operation on a 2-tuple of (String, Codec) pairs. |
| Codec3KVOps<A, B, C> | Record | Provides a product operation on a 3-tuple of KeyValueCodecs. |
| Codec3Ops<A, B, C> | Record | Provides a product operation on a 3-tuple of (String, Codec) pairs. |
| Codec4KVOps<A, B, C, D> | Record | Provides a product operation on a 4-tuple of KeyValueCodecs. |
| Codec4Ops<A, B, C, D> | Record | Provides a product operation on a 4-tuple of (String, Codec) pairs. |
| Codec5KVOps<A, B, C, D, E> | Record | Provides a product operation on a 5-tuple of KeyValueCodecs. |
| Codec5Ops<A, B, C, D, E> | Record | Provides a product operation on a 5-tuple of (String, Codec) pairs. |
| Codec6KVOps<A, B, C, D, E, F> | Record | Provides a product operation on a 6-tuple of KeyValueCodecs. |
| Codec6Ops<A, B, C, D, E, F> | Record | Provides a product operation on a 6-tuple of (String, Codec) pairs. |
| Codec7KVOps<A, B, C, D, E, F, G> | Record | Provides a product operation on a 7-tuple of KeyValueCodecs. |
| Codec7Ops<A, B, C, D, E, F, G> | Record | Provides a product operation on a 7-tuple of (String, Codec) pairs. |
| Codec8KVOps<A, B, C, D, E, F, G, H> | Record | Provides a product operation on a 8-tuple of KeyValueCodecs. |
| Codec8Ops<A, B, C, D, E, F, G, H> | Record | Provides a product operation on a 8-tuple of (String, Codec) pairs. |
| Codec9KVOps<A, B, C, D, E, F, G, H, I> | Record | Provides a product operation on a 9-tuple of KeyValueCodecs. |
| Codec9Ops<A, B, C, D, E, F, G, H, I> | Record | Provides a product operation on a 9-tuple of (String, Codec) pairs. |
| KeyValueCodecOps | String |
Typedefs
| Typedef | Description |
|---|---|
| DecodeResult<A> | The result of a Decoder: either a DecodingFailure or a value of A. |