Skip to content

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

ClassDescription
ACursorAbstract cursor over a Json tree, providing navigation and decoding.
ArrayIndexA PathElem representing a JSON array element access.
AsyncParserA stateful, incremental JSON parser that accepts data in chunks.
Codec<A>Bidirectional JSON codec that combines a Decoder and an Encoder.
CursorOpA single step recorded in an ACursor's history.
CustomReasonA 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.
DecodingFailureAn error produced when a Decoder cannot produce a value from the focused Json.
DeleteGoParentThe focused value was deleted and the cursor moved to the parent.
DownArrayCursor descended into the first element of a JSON array.
DownFieldCursor descended into field key of a JSON object.
DownNCursor descended into element n of a JSON array.
Encoder<A>Encodes a Dart value of type A into a Json value.
ErrorBase type for all JSON errors. Subtypes are ParsingFailure and DecodingFailure.
FailedCursorAn ACursor representing a failed navigation step.
FieldCursor moved to a sibling field key within the same JSON object.
HCursorA successful ACursor positioned at a Json value.
JArrayA JSON array value.
JBooleanA JSON boolean value (true or false).
JNullThe JSON null value.
JNumberA JSON number value.
JObjectA JSON object value.
JsonAn immutable JSON value.
JsonFolder<A>Visitor interface for exhaustively processing a Json value.
JsonObjectAn 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.
JStringA 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.
MissingFieldIndicates that a required field was absent from the JSON object.
MoveLeftCursor moved left to the previous array element.
MoveRightCursor moved right to the next array element.
MoveUpCursor moved up to the parent JSON value.
ObjectKeyA PathElem representing a JSON object field access.
ParsingFailureAn error produced when the JSON input is syntactically invalid.
PathElemA single element in a PathToRoot: either an object key or an array index.
PathToRootThe sequence of PathElems from the root of a Json tree to the cursor position, used to render a human-readable location in DecodingFailure messages.
PrinterRenders a Json value to a formatted String.
ReasonSealed base for the reason a DecodingFailure occurred.
WrongTypeExpectationIndicates that the focused Json value was not of the expected type.

Exceptions

ExceptionDescription
AsyncExceptionInternal sentinel thrown when AsyncParser runs out of buffered data mid-parse; caught and handled by AsyncParser itself.

Enums

EnumDescription
AsyncParserModeControls how an AsyncParser interprets its input stream.

Extensions

ExtensiononDescription
Codec10KVOps<A, B, C, D, E, F, G, H, I, J>RecordProvides a product operation on a 10-tuple of KeyValueCodecs.
Codec10Ops<A, B, C, D, E, F, G, H, I, J>RecordProvides a product operation on a 10-tuple of (String, Codec) pairs.
Codec11KVOps<A, B, C, D, E, F, G, H, I, J, K>RecordProvides a product operation on a 11-tuple of KeyValueCodecs.
Codec11Ops<A, B, C, D, E, F, G, H, I, J, K>RecordProvides a product operation on a 11-tuple of (String, Codec) pairs.
Codec12KVOps<A, B, C, D, E, F, G, H, I, J, K, L>RecordProvides a product operation on a 12-tuple of KeyValueCodecs.
Codec12Ops<A, B, C, D, E, F, G, H, I, J, K, L>RecordProvides 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>RecordProvides a product operation on a 13-tuple of KeyValueCodecs.
Codec13Ops<A, B, C, D, E, F, G, H, I, J, K, L, M>RecordProvides 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>RecordProvides a product operation on a 14-tuple of KeyValueCodecs.
Codec14Ops<A, B, C, D, E, F, G, H, I, J, K, L, M, N>RecordProvides 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>RecordProvides 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>RecordProvides 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>RecordProvides 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>RecordProvides 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>RecordProvides 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>RecordProvides 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>RecordProvides 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>RecordProvides 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>RecordProvides 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>RecordProvides 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>RecordProvides 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>RecordProvides 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>RecordProvides 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>RecordProvides 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>RecordProvides 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>RecordProvides a product operation on a 22-tuple of (String, Codec) pairs.
Codec2KVOps<A, B>RecordProvides a product operation on a 2-tuple of KeyValueCodecs.
Codec2Ops<A, B>RecordProvides a product operation on a 2-tuple of (String, Codec) pairs.
Codec3KVOps<A, B, C>RecordProvides a product operation on a 3-tuple of KeyValueCodecs.
Codec3Ops<A, B, C>RecordProvides a product operation on a 3-tuple of (String, Codec) pairs.
Codec4KVOps<A, B, C, D>RecordProvides a product operation on a 4-tuple of KeyValueCodecs.
Codec4Ops<A, B, C, D>RecordProvides a product operation on a 4-tuple of (String, Codec) pairs.
Codec5KVOps<A, B, C, D, E>RecordProvides a product operation on a 5-tuple of KeyValueCodecs.
Codec5Ops<A, B, C, D, E>RecordProvides a product operation on a 5-tuple of (String, Codec) pairs.
Codec6KVOps<A, B, C, D, E, F>RecordProvides a product operation on a 6-tuple of KeyValueCodecs.
Codec6Ops<A, B, C, D, E, F>RecordProvides a product operation on a 6-tuple of (String, Codec) pairs.
Codec7KVOps<A, B, C, D, E, F, G>RecordProvides a product operation on a 7-tuple of KeyValueCodecs.
Codec7Ops<A, B, C, D, E, F, G>RecordProvides a product operation on a 7-tuple of (String, Codec) pairs.
Codec8KVOps<A, B, C, D, E, F, G, H>RecordProvides a product operation on a 8-tuple of KeyValueCodecs.
Codec8Ops<A, B, C, D, E, F, G, H>RecordProvides a product operation on a 8-tuple of (String, Codec) pairs.
Codec9KVOps<A, B, C, D, E, F, G, H, I>RecordProvides a product operation on a 9-tuple of KeyValueCodecs.
Codec9Ops<A, B, C, D, E, F, G, H, I>RecordProvides a product operation on a 9-tuple of (String, Codec) pairs.
KeyValueCodecOpsString

Typedefs

TypedefDescription
DecodeResult<A>The result of a Decoder: either a DecodingFailure or a value of A.