LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • Client
  • AsyncClient
  • Run Helpers
  • Run Trees
  • Evaluation
  • Schemas
  • Utilities
  • Wrappers
  • Anonymizer
  • Testing
  • Expect API
  • Middleware
  • Pytest Plugin
  • Deployment SDK
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

OverviewClientAsyncClientRun HelpersRun TreesEvaluationSchemasUtilitiesWrappersAnonymizerTestingExpect APIMiddlewarePytest PluginDeployment SDK
Language
Theme
Pythonlangsmith_openapi_client_modelsBaseModelmodel_dump_json
Method●Since v0.8

model_dump_json

Copy
model_dump_json(
  self,
  *,
  indent: int | None = None,
  ensure_ascii: bool
View source on GitHub
=
False
,
include
:
IncEx
|
None
=
None
,
exclude
:
IncEx
|
None
=
None
,
context
:
Any
|
None
=
None
,
by_alias
:
bool
|
None
=
None
,
exclude_unset
:
bool
=
False
,
exclude_defaults
:
bool
=
False
,
exclude_none
:
bool
=
False
,
exclude_computed_fields
:
bool
=
False
,
round_trip
:
bool
=
False
,
warnings
:
bool
|
Literal
[
'none'
,
'warn'
,
'error'
]
=
True
,
fallback
:
Callable
[
[
Any
]
,
Any
]
|
None
=
None
,
serialize_as_any
:
bool
=
False
)
->
str

Parameters

NameTypeDescription
indentint | None
Default:None

Indentation to use in the JSON output. If None is passed, the output will be compact.

includeIncEx | None
Default:None

Field(s) to include in the JSON output. Can take either a string or set of strings.

excludeIncEx | None
Default:None
by_aliasbool | None
Default:None
exclude_unsetbool
Default:False
exclude_defaultsbool
Default:False
exclude_nonebool
Default:False
round_tripbool
Default:False
warningsbool | Literal['none', 'warn', 'error']
Default:True

Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump_json

Generates a JSON representation of the model using Pydantic's to_json method.

Field(s) to exclude from the JSON output. Can take either a string or set of strings.

Whether to serialize using field aliases.

Whether to exclude fields that have not been explicitly set.

Whether to exclude fields that have the default value.

Whether to exclude fields that have a value of None.

Whether to use serialization/deserialization between JSON and class instance.

Whether to show any warnings that occurred during serialization.