<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>nainaistar</author_name>
  <author_url>https://blog.hatena.ne.jp/nainaistar/</author_url>
  <blog_title>きり丸の技術日記</blog_title>
  <blog_url>https://nainaistar.hatenablog.com/</blog_url>
  <categories>
    <anon>Python</anon>
    <anon>技術</anon>
  </categories>
  <description>始めに PydanticにはJsonという便利な型があります。便利ではあるのですが、素のJson型では開発しづらい点があったので自分のアプリケーションでは拡張して使っています。 今回の記事では何に困ったのか、どのように拡張したのかを記載します。 環境 Python 3.12.4 FastAPI 0.114.2 Pydantic 2.9.1 ユースケース フロントで自由なデータ構造を定義してバックエンドとしては単純に保存する。また、フロントで取り出せるようにバックエンドで保存したデータ構造をフロントに返却する。 困ったケース PydanticのJsonで定義するとフロントで定義した自由なデータ構…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fnainaistar.hatenablog.com%2Fentry%2Fcustomize-pydantic-json-type&quot; title=&quot;PydanticのJsonはそのまま使わないほうがいい - きり丸の技術日記&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url>https://cdn-ak.f.st-hatena.com/images/fotolife/n/nainaistar/20240922/20240922202950.png</image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2024-09-23 12:00:00</published>
  <title>PydanticのJsonはそのまま使わないほうがいい</title>
  <type>rich</type>
  <url>https://nainaistar.hatenablog.com/entry/customize-pydantic-json-type</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
