adk_json (erlang_adk v0.7.0)

View Source

Safe conversion of ordinary Erlang values to a JSON value.

This module is intentionally small and deterministic. It is used at tool and transport boundaries so internal terms such as pids, references, funs, ports, and arbitrary printable crash data never leak into model prompts or externally visible events.

Summary

Types

error_reason/0

-type error_reason() ::
          {unsupported_json_term, [path_part()], atom()} |
          {invalid_utf8, [path_part()]} |
          {invalid_map_key, [path_part()], atom()} |
          {duplicate_map_key, [path_part()], binary()}.

path_part/0

-type path_part() :: binary() | non_neg_integer().

Functions

normalize(Value)

-spec normalize(term()) -> {ok, term()} | {error, error_reason()}.

normalize(Value, Path)

-spec normalize(term(), [path_part()]) -> {ok, term()} | {error, error_reason()}.