View Source ExOciSdk.JSON behaviour (ex_oci_sdk v0.2.2)

Defines the behavior for JSON encoding and decoding. This module provides a consistent interface for working with JSON, allowing different implementations (such as Jason, Poison, Native, etc).

Summary

Callbacks

Decodes JSON into an Elixir map.

defines the dependencies necessary for the module

Encodes a map into JSON as iodata.

Types

decode_error()

@type decode_error() :: Exception.t()

encode_error()

@type encode_error() :: Exception.t()

json_options()

@type json_options() :: keyword()

Callbacks

decode!(input, options)

@callback decode!(
  input :: iodata(),
  options :: json_options()
) :: map() | no_return()

Decodes JSON into an Elixir map.

Parameters

  • input - JSON string or iodata to decode
  • options - Decoding options

Raises

  • decode_error - If the input is not valid JSON

deps()

@callback deps() :: atom() | [atom()] | []

defines the dependencies necessary for the module

encode_to_iodata!(input, options)

@callback encode_to_iodata!(
  input :: map(),
  options :: json_options()
) :: iodata() | no_return()

Encodes a map into JSON as iodata.

Parameters

  • input - Map to be encoded
  • options - Encoding options

Raises

  • encode_error - If the input cannot be encoded to JSON