dataclass-wizard icon indicating copy to clipboard operation
dataclass-wizard copied to clipboard

Add `dataclass_wizard.formats.*` functional API (loads/dumps/load/dump) for JSON/YAML/TOML/ENV

Open rnag opened this issue 2 months ago • 0 comments

  • Goal: Provide a non-mixin API for format conversions.

  • Proposed API:

    • dataclass_wizard.formats.json.loads(cls, s, **kw) -> cls
    • ...json.dumps(obj, **kw) -> str
    • ...json.load(cls, fp, **kw) -> cls
    • ...json.dump(obj, fp, **kw) -> None
    • Same for yaml, toml, env (dotenv-style) where applicable.
  • Acceptance criteria:

    • Mixins delegate to format functions (single source of truth).
    • Optional deps remain optional (ImportError with clear “install extra” message).
    • Docs: add a “Formats API” section with examples.

rnag avatar Dec 21 '25 22:12 rnag