| 1346 | |
| 1347 | @typing_extensions.deprecated('The `json` method is deprecated; use `model_dump_json` instead.', category=None) |
| 1348 | def json( # noqa: D102 |
| 1349 | self, |
| 1350 | *, |
| 1351 | include: IncEx | None = None, |
| 1352 | exclude: IncEx | None = None, |
| 1353 | by_alias: bool = False, |
| 1354 | exclude_unset: bool = False, |
| 1355 | exclude_defaults: bool = False, |
| 1356 | exclude_none: bool = False, |
| 1357 | encoder: Callable[[Any], Any] | None = PydanticUndefined, # type: ignore[assignment] |
| 1358 | models_as_dict: bool = PydanticUndefined, # type: ignore[assignment] |
| 1359 | **dumps_kwargs: Any, |
| 1360 | ) -> str: |
| 1361 | warnings.warn( |
| 1362 | 'The `json` method is deprecated; use `model_dump_json` instead.', |
| 1363 | category=PydanticDeprecatedSince20, |
| 1364 | stacklevel=2, |
| 1365 | ) |
| 1366 | if encoder is not PydanticUndefined: |
| 1367 | raise TypeError('The `encoder` argument is no longer supported; use field serializers instead.') |
| 1368 | if models_as_dict is not PydanticUndefined: |
| 1369 | raise TypeError('The `models_as_dict` argument is no longer supported; use a model serializer instead.') |
| 1370 | if dumps_kwargs: |
| 1371 | raise TypeError('`dumps_kwargs` keyword arguments are no longer supported.') |
| 1372 | return self.model_dump_json( |
| 1373 | include=include, |
| 1374 | exclude=exclude, |
| 1375 | by_alias=by_alias, |
| 1376 | exclude_unset=exclude_unset, |
| 1377 | exclude_defaults=exclude_defaults, |
| 1378 | exclude_none=exclude_none, |
| 1379 | ) |
| 1380 | |
| 1381 | @classmethod |
| 1382 | @typing_extensions.deprecated('The `parse_obj` method is deprecated; use `model_validate` instead.', category=None) |