- Sort Score
- Num 10 results
- Language All
Results 21 - 30 of 58 for jsonable_encoder (0.07 seconds)
-
docs/en/docs/reference/encoders.md
# Encoders - `jsonable_encoder`
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Wed Oct 18 12:36:40 GMT 2023 - 71 bytes - Click Count (0) -
docs/en/docs/advanced/response-directly.md
When you create a **FastAPI** *path operation* you can normally return any data from it: a `dict`, a `list`, a Pydantic model, a database model, etc. By default, **FastAPI** would automatically convert that return value to JSON using the `jsonable_encoder` explained in [JSON Compatible Encoder](../tutorial/encoder.md){.internal-link target=_blank}.
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Wed Dec 17 20:41:43 GMT 2025 - 3.1K bytes - Click Count (0) -
docs_src/encoder/tutorial001_py39.py
from fastapi import FastAPI from fastapi.encoders import jsonable_encoder from pydantic import BaseModel fake_db = {} class Item(BaseModel): title: str timestamp: datetime description: Union[str, None] = None app = FastAPI() @app.put("/items/{id}") def update_item(id: str, item: Item): json_compatible_item_data = jsonable_encoder(item)Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Wed Dec 17 20:41:43 GMT 2025 - 461 bytes - Click Count (0) -
docs_src/response_directly/tutorial001_py39.py
from fastapi import FastAPI from fastapi.encoders import jsonable_encoder from fastapi.responses import JSONResponse from pydantic import BaseModel class Item(BaseModel): title: str timestamp: datetime description: Union[str, None] = None app = FastAPI() @app.put("/items/{id}") def update_item(id: str, item: Item): json_compatible_item_data = jsonable_encoder(item)
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Wed Dec 17 20:41:43 GMT 2025 - 505 bytes - Click Count (0) -
docs/ru/docs/tutorial/encoder.md
Например, если необходимо хранить его в базе данных. Для этого **FastAPI** предоставляет функцию `jsonable_encoder()`. ## Использование `jsonable_encoder` { #using-the-jsonable-encoder } Представим, что у вас есть база данных `fake_db`, которая принимает только JSON-совместимые данные.Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Tue Sep 30 11:24:39 GMT 2025 - 2.7K bytes - Click Count (0) -
docs/es/docs/tutorial/encoder.md
Por ejemplo, si necesitas almacenarlo en una base de datos. Para eso, **FastAPI** proporciona una función `jsonable_encoder()`. ## Usando el `jsonable_encoder` { #using-the-jsonable-encoder } Imaginemos que tienes una base de datos `fake_db` que solo recibe datos compatibles con JSON.Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Tue Dec 16 16:33:45 GMT 2025 - 1.8K bytes - Click Count (0) -
docs/de/docs/tutorial/encoder.md
Zum Beispiel, wenn Sie es in einer Datenbank speichern möchten. Dafür bietet **FastAPI** eine Funktion `jsonable_encoder()`. ## `jsonable_encoder` verwenden { #using-the-jsonable-encoder } Stellen wir uns vor, Sie haben eine Datenbank `fake_db`, die nur JSON-kompatible Daten entgegennimmt.Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Sat Sep 20 15:10:09 GMT 2025 - 1.8K bytes - Click Count (0) -
docs/ko/docs/advanced/response-directly.md
이로 인해 많은 유연성을 얻을 수 있습니다. 어떤 데이터 유형이든 반환할 수 있고, 데이터 선언이나 유효성 검사를 재정의할 수 있습니다. ## `Response`에서 `jsonable_encoder` 사용하기 **FastAPI**는 반환하는 `Response`에 아무런 변환을 하지 않으므로, 그 내용이 준비되어 있어야 합니다. 예를 들어, Pydantic 모델을 `dict`로 변환해 `JSONResponse`에 넣지 않으면 JSON 호환 유형으로 변환된 데이터 유형(예: `datetime`, `UUID` 등)이 사용되지 않습니다. 이러한 경우, 데이터를 응답에 전달하기 전에 `jsonable_encoder`를 사용하여 변환할 수 있습니다: {* ../../docs_src/response_directly/tutorial001.py hl[6:7,21:22] *}Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Mon Nov 18 02:25:44 GMT 2024 - 3.4K bytes - Click Count (0) -
docs/ja/docs/advanced/response-directly.md
これは多くの柔軟性を提供します。任意のデータ型を返したり、任意のデータ宣言やバリデーションをオーバーライドできます。 ## `jsonable_encoder` を `Response` の中で使う **FastAPI** はあなたが返す `Response` に対して何も変更を加えないので、コンテンツが準備できていることを保証しなければなりません。 例えば、Pydanticモデルを `JSONResponse` に含めるには、すべてのデータ型 (`datetime` や `UUID` など) をJSON互換の型に変換された `dict` に変換しなければなりません。 このようなケースでは、レスポンスにデータを含める前に `jsonable_encoder` を使ってデータを変換できます。 {* ../../docs_src/response_directly/tutorial001.py hl[6:7,21:22] *}Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Mon Nov 18 02:25:44 GMT 2024 - 3.6K bytes - Click Count (0) -
docs_src/encoder/tutorial001_py310.py
from fastapi import FastAPI from fastapi.encoders import jsonable_encoder from pydantic import BaseModel fake_db = {} class Item(BaseModel): title: str timestamp: datetime description: str | None = None app = FastAPI() @app.put("/items/{id}") def update_item(id: str, item: Item): json_compatible_item_data = jsonable_encoder(item)Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Fri Jan 07 14:11:31 GMT 2022 - 430 bytes - Click Count (0)