Common Use Cases¶

  • Map a JSON Key to a Field
    • Map a Field Back to a JSON Key
  • Cyclic or “Recursive” Dataclasses
    • With Class Inheritance
    • Without Class Inheritance
  • Dataclasses in Union types
    • Auto-Assign Tags
    • Manually Assigning Tags
  • Easier Debug Mode
    • Simpler Debugging with debug
    • Key Points
    • Examples of Log Levels
  • Handling Unknown JSON Keys
    • Default Behavior
    • Raising Errors on Unknown Keys
    • Capturing Unknown Keys with CatchAll
    • Best Practices
  • Extending from Meta
    • Any Meta settings only affect a class model
    • Global Meta settings
  • Map a Nested JSON Key Path to a Field
    • Basic Usage Example
    • Expanded Example with JSON
    • Object Path Notation
    • Path Parsing Examples
    • Handling Quotes
    • Best Practices
  • Patterned Date and Time
    • Containers of Date and Time
  • Serialization Options
    • Skip Defaults
    • Exclude Fields
    • “Skip If” Functionality
  • Skip the Class Inheritance
  • Skip the __str__()
  • Alias
    • Field Aliases
    • AliasPath
  • Patterned Date and Time in V1 (v0.35.0+)
    • Pattern Comparison
    • Standard Date-Time Patterns
    • Timezone-Aware Date and Time Patterns
    • UTC Date and Time Patterns
    • Containers of Date and Time
    • Multiple Date and Time Patterns
  • Wizard Mixin Classes
    • EnvWizard
    • JSONPyWizard
    • JSONListWizard
    • JSONFileWizard
    • YAMLWizard
    • TOMLWizard

Dataclass Wizard

Bring Python dataclasses to life — the wizard way!

Useful Links

  • Overview
  • Installation
  • Examples
  • Py Compatibility
  • Common Use Cases
  • Advanced Usage
  • Release History
  • Contributors Guide
  • Env Magic
  • CLI Tool
  • Using Field Properties
  • 🗣 GitHub Discussions
  • 🎯 Issue Tracker
  • Dataclass Wizard @
  • GitHub | PyPI | Anaconda | Stack Overflow

Related Topics

  • Documentation overview
    • Previous: Py Compatibility
    • Next: Map a JSON Key to a Field

API Reference

  • Index
  • Module Index

This Page

  • Show Source

Quick search

©2021-2025, Ritvik Nag. | Page source
Fork me on GitHub