anmolitor / elm-protoc-utils / Protobuf.Utils.Dict

Utility methods for Dict needed in the Protobuf/gRPC context.

dictDecoder : (String -> Result String comparable) -> Json.Decode.Decoder v -> Json.Decode.Decoder (Dict comparable v)

Decode a dict from JSON with non-String key type. This is done by first decoding into a dict/list of key/value pairs with Strings as keys and then decoding each key while inserting them into a new dict.