You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1.5 KiB

🎻 🔗 🔢

📤 💼 🌐 👆 5️⃣📆 💪 🗜 💽 🆎 (💖 Pydantic 🏷) 🕳 🔗 ⏮️ 🎻 (💖 dict, list, ️).

🖼, 🚥 👆 💪 🏪 💽.

👈, FastAPI 🚚 jsonable_encoder() 🔢.

⚙️ jsonable_encoder

➡️ 🌈 👈 👆 ✔️ 💽 fake_db 👈 🕴 📨 🎻 🔗 💽.

🖼, 🚫 📨 datetime 🎚, 👈 🚫 🔗 ⏮️ 🎻.

, datetime 🎚 🔜 ✔️ 🗜 str💽 💾 📁.

🎏 🌌, 👉 💽 🚫🔜 📨 Pydantic 🏷 (🎚 ⏮️ 🔢), 🕴 dict.

👆 💪 ⚙️ jsonable_encoder 👈.

📨 🎚, 💖 Pydantic 🏷, & 📨 🎻 🔗 :

=== "🐍 3️⃣.6️⃣ & 🔛"

```Python hl_lines="5  22"
{!> ../../../docs_src/encoder/tutorial001.py!}
```

=== "🐍 3️⃣.1️⃣0️⃣ & 🔛"

```Python hl_lines="4  21"
{!> ../../../docs_src/encoder/tutorial001_py310.py!}
```

👉 🖼, 🔜 🗜 Pydantic 🏷 dict, & datetime str.

🏁 🤙 ️ 🕳 👈 💪 🗜 ⏮️ 🐍 🐩 json.dumps().

🚫 📨 str💽 🎻 📁 (🎻). 📨 🐍 🐩 💽 📊 ( dict) ⏮️ 💲 & 🎧-💲 👈 🌐 🔗 ⏮️ 🎻.

!!! note jsonable_encoder 🤙 ⚙️ FastAPI 🔘 🗜 💽. ️ ⚠ 📚 🎏 😐.