- Sort Score
- Num 10 results
- Language All
Results 11 - 20 of 97 for jsonable_encoder (0.12 seconds)
-
docs_src/body_updates/tutorial001_py310.py
from fastapi import FastAPI from fastapi.encoders import jsonable_encoder from pydantic import BaseModel app = FastAPI() class Item(BaseModel): name: str | None = None description: str | None = None price: float | None = None tax: float = 10.5 tags: list[str] = [] items = { "foo": {"name": "Foo", "price": 50.2}, "bar": {"name": "Bar", "description": "The bartenders", "price": 62, "tax": 20.2},
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Jan 07 14:11:31 GMT 2022 - 856 bytes - Click Count (0) -
docs/ko/docs/tutorial/body-updates.md
# Body - 업데이트 { #body-updates } ## `PUT`으로 교체 업데이트하기 { #update-replacing-with-put } 항목을 업데이트하려면 [HTTP `PUT`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PUT) 작업을 사용할 수 있습니다. `jsonable_encoder`를 사용해 입력 데이터를 JSON으로 저장할 수 있는 데이터로 변환할 수 있습니다(예: NoSQL 데이터베이스 사용 시). 예를 들어 `datetime`을 `str`로 변환하는 경우입니다. {* ../../docs_src/body_updates/tutorial001_py310.py hl[28:33] *} `PUT`은 기존 데이터를 **대체**해야 하는 데이터를 받는 데 사용합니다.Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 14:06:26 GMT 2026 - 4.8K bytes - Click Count (0) -
fastapi/openapi/utils.py
example = getattr(field_info, "example", None) if openapi_examples: parameter["examples"] = jsonable_encoder(openapi_examples) elif example is not _Unset: parameter["example"] = jsonable_encoder(example) if getattr(field_info, "deprecated", None): parameter["deprecated"] = True parameters.append(parameter)
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Mar 15 11:44:39 GMT 2026 - 25.6K bytes - Click Count (0) -
docs/en/docs/advanced/custom-response.md
If you declare a [Response Model](../tutorial/response-model.md) FastAPI will use it to serialize the data to JSON, using Pydantic. If you don't declare a response model, FastAPI will use the `jsonable_encoder` explained in [JSON Compatible Encoder](../tutorial/encoder.md) and put it in a `JSONResponse`.
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 05 18:13:19 GMT 2026 - 11K bytes - Click Count (0) -
docs/en/docs/tutorial/body-updates.md
## Update replacing with `PUT` { #update-replacing-with-put } To update an item you can use the [HTTP `PUT`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PUT) operation. You can use the `jsonable_encoder` to convert the input data to data that can be stored as JSON (e.g. with a NoSQL database). For example, converting `datetime` to `str`. {* ../../docs_src/body_updates/tutorial001_py310.py hl[28:33] *}Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 05 18:13:19 GMT 2026 - 4K bytes - Click Count (0) -
docs/zh-hant/docs/tutorial/body-updates.md
# Body - 更新 { #body-updates } ## 使用 `PUT` 取代式更新 { #update-replacing-with-put } 要更新一個項目,你可以使用 [HTTP `PUT`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PUT) 操作。 你可以使用 `jsonable_encoder` 將輸入資料轉換為可儲存為 JSON 的資料(例如用於 NoSQL 資料庫)。例如把 `datetime` 轉成 `str`。 {* ../../docs_src/body_updates/tutorial001_py310.py hl[28:33] *} `PUT` 用於接收應該取代現有資料的資料。 ### 關於取代的警告 { #warning-about-replacing } 這表示,如果你想用 `PUT` 並在 body 中包含以下內容來更新項目 `bar`:Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 17:05:38 GMT 2026 - 3.7K bytes - Click Count (0) -
docs/zh/docs/tutorial/body-updates.md
# 请求体 - 更新数据 { #body-updates } ## 用 `PUT` 替换式更新 { #update-replacing-with-put } 更新数据可以使用 [HTTP `PUT`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PUT) 操作。 把输入数据转换为以 JSON 格式存储的数据(比如,使用 NoSQL 数据库时),可以使用 `jsonable_encoder`。例如,把 `datetime` 转换为 `str`。 {* ../../docs_src/body_updates/tutorial001_py310.py hl[28:33] *} `PUT` 用于接收替换现有数据的数据。 ### 关于替换的警告 { #warning-about-replacing } 用 `PUT` 把数据项 `bar` 更新为以下请求体时: ```Python {Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 17:06:37 GMT 2026 - 3.7K bytes - Click Count (0) -
fastapi/openapi/docs.py
import json from typing import Annotated, Any from annotated_doc import Doc from fastapi.encoders import jsonable_encoder from starlette.responses import HTMLResponse def _html_safe_json(value: Any) -> str: """Serialize a value to JSON with HTML special characters escaped. This prevents injection when the JSON is embedded inside a <script> tag. """ return ( json.dumps(value) .replace("<", "\\u003c")
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Tue Feb 24 09:28:10 GMT 2026 - 12.1K bytes - Click Count (0) -
docs/ja/docs/tutorial/body-updates.md
# ボディ - 更新 { #body-updates } ## `PUT`による置換での更新 { #update-replacing-with-put } 項目を更新するには[HTTPの`PUT`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PUT)操作を使用することができます。 `jsonable_encoder`を用いて、入力データをJSONとして保存できるデータに変換することができます(例:NoSQLデータベース)。例えば、`datetime`を`str`に変換します。 {* ../../docs_src/body_updates/tutorial001_py310.py hl[28:33] *} `PUT`は、既存のデータを置き換えるべきデータを受け取るために使用されます。 ### 置換についての注意 { #warning-about-replacing }Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 14:07:17 GMT 2026 - 5.2K bytes - Click Count (0) -
docs/ko/docs/tutorial/stream-json-lines.md
이 경우 함수가 async가 아니므로, 올바른 반환 타입은 `Iterable[Item]`입니다: {* ../../docs_src/stream_json_lines/tutorial001_py310.py ln[27:30] hl[28] *} ### 반환 타입 생략 { #no-return-type } 반환 타입을 생략할 수도 있습니다. 그러면 FastAPI가 [`jsonable_encoder`](./encoder.md)를 사용해 데이터를 JSON으로 직렬화 가능한 형태로 변환한 뒤 JSON Lines로 전송합니다. {* ../../docs_src/stream_json_lines/tutorial001_py310.py ln[33:36] hl[34] *} ## 서버 전송 이벤트(SSE) { #server-sent-events-sse }Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 19 18:56:39 GMT 2026 - 4.8K bytes - Click Count (0)