Sinter.JSON (Sinter v0.1.0)
View SourceJSON encode/decode helpers with Sinter validation and transforms.
Summary
Functions
Decodes JSON and validates against a schema.
Decodes JSON and validates against a schema, raising on failure.
Encodes data as JSON after applying the transform pipeline.
Encodes data as JSON and raises on failure.
Types
@type decode_opts() :: Sinter.Validator.validation_opts()
Functions
@spec decode(String.t(), Sinter.Schema.t(), decode_opts()) :: {:ok, map()} | {:error, [Sinter.Error.t()]}
Decodes JSON and validates against a schema.
@spec decode!(String.t(), Sinter.Schema.t(), decode_opts()) :: map()
Decodes JSON and validates against a schema, raising on failure.
@spec encode(term(), encode_opts()) :: {:ok, String.t()} | {:error, term()}
Encodes data as JSON after applying the transform pipeline.
@spec encode!(term(), encode_opts()) :: String.t()
Encodes data as JSON and raises on failure.