_CustomEncoder Class — anthropic-sdk-python Architecture
Architecture documentation for the _CustomEncoder class in _json.py from the anthropic-sdk-python codebase.
Entity Profile
Dependency Diagram
graph TD 9ae2bf11_c83f_4579_f444_e2ce01769bf9["_CustomEncoder"] add5a69b_d84f_deef_9958_765008080340["_json.py"] 9ae2bf11_c83f_4579_f444_e2ce01769bf9 -->|defined in| add5a69b_d84f_deef_9958_765008080340 f73e0710_f22c_8ab8_ec1c_fbe8e5e5057f["default()"] 9ae2bf11_c83f_4579_f444_e2ce01769bf9 -->|method| f73e0710_f22c_8ab8_ec1c_fbe8e5e5057f
Relationship Graph
Source Code
src/anthropic/_utils/_json.py lines 28–35
class _CustomEncoder(json.JSONEncoder):
@override
def default(self, o: Any) -> Any:
if isinstance(o, datetime):
return o.isoformat()
if isinstance(o, pydantic.BaseModel):
return model_dump(o, exclude_unset=True, mode="json", by_alias=True)
return super().default(o)
Domain
Defined In
Source
Frequently Asked Questions
What is the _CustomEncoder class?
_CustomEncoder is a class in the anthropic-sdk-python codebase, defined in src/anthropic/_utils/_json.py.
Where is _CustomEncoder defined?
_CustomEncoder is defined in src/anthropic/_utils/_json.py at line 28.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free