aws/internal/codec/json_document

smithy.api#Document codec. Documents are “any JSON value” — the service doesn’t constrain the shape. We carry them as json.Json so round-trips are byte-stable: decode a document field, re-encode it, and you get the same JSON back out.

Backed by FFI because gleam_json.Json is opaque and there’s no public constructor for “raw JSON”. On the Erlang side Json is just iodata, so raw/1 is a no-op cast.

Values

pub fn decoder() -> decode.Decoder(json.Json)

Decoder for a Document field. Always succeeds — Documents accept any JSON shape including nulls, so failure is never the right answer at this layer.

pub fn from_dynamic(d: dynamic.Dynamic) -> json.Json

Take a dynamic value (whatever decode.dynamic produced) and turn it into a json.Json. Round-trips through aws_ffi:encode_dynamic_to_json, then casts the resulting binary back to the opaque Json type.

Search Document