You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* docs: update pydantic `.json` and `.dict` methods in docs
* docs: update examples
* docs: update `__root__` elements by `root`
* docs: update `__root__` elements by `root`
And one could get the contents by using `regular Pydantic-object methods <https://pydantic-docs.helpmanual.io/usage/exporting_models/>`_, such as ``.dict()`` or ``.json()``
95
+
And one could get the contents by using `regular Pydantic-object methods <https://pydantic-docs.helpmanual.io/usage/exporting_models/>`_, such as ``.model_dump()`` or ``.model_dump_json()``
And one could get the contents by using `regular Pydantic-object methods <https://pydantic-docs.helpmanual.io/usage/exporting_models/>`_, such as ``.dict()`` or ``.json()``
205
+
And one could get the contents by using `regular Pydantic-object methods <https://pydantic-docs.helpmanual.io/usage/exporting_models/>`_, such as ``.model_dump()`` or ``.model_dump_json()``
206
206
207
207
.. code-block:: py3
208
208
209
-
>>> print(tourpy.dict())
209
+
>>> print(tourpy.model_dump())
210
210
{
211
-
'__root__': [
211
+
'root': [
212
212
{
213
213
'id': 2,
214
214
'name': 'Another',
@@ -226,7 +226,7 @@ And one could get the contents by using `regular Pydantic-object methods <https:
226
226
}
227
227
]
228
228
}
229
-
>>> print(tourpy.json())
229
+
>>> print(tourpy.model_dump_json())
230
230
[
231
231
{
232
232
"id": 2,
@@ -245,7 +245,7 @@ And one could get the contents by using `regular Pydantic-object methods <https:
245
245
}
246
246
]
247
247
248
-
Note how ``.dict()`` has a ``_root__`` element with the list, but the ``.json()`` has the list as root.
248
+
Note how ``.model_dump()`` has a ``root`` element with the list, but the ``.model_dump_json()`` has the list as root.
249
249
Also note how the results are sorted alphabetically by ``name``.
250
250
251
251
@@ -479,7 +479,7 @@ Lets create and serialise the objects and see what they look like *(in an async
0 commit comments