Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 3 of 3 for star (0.12 sec)

  1. docs/en/docs/tutorial/encoder.md

        ```
    
    In this example, it would convert the Pydantic model to a `dict`, and the `datetime` to a `str`.
    
    The result of calling it is something that can be encoded with the Python standard <a href="https://docs.python.org/3/library/json.html#json.dumps" class="external-link" target="_blank">`json.dumps()`</a>.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Oct 17 05:59:11 GMT 2023
    - 1.8K bytes
    - Viewed (0)
  2. docs/zh/docs/tutorial/encoder.md

        {!> ../../../docs_src/encoder/tutorial001.py!}
        ```
    
    在这个例子中,它将Pydantic模型转换为`dict`,并将`datetime`转换为`str`。
    
    调用它的结果后就可以使用Python标准编码中的<a href="https://docs.python.org/3/library/json.html#json.dumps" class="external-link" target="_blank">`json.dumps()`</a>。
    
    这个操作不会返回一个包含JSON格式(作为字符串)数据的庞大的`str`。它将返回一个Python标准数据结构(例如`dict`),其值和子值都与JSON兼容。
    
    !!! note
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Oct 17 05:59:11 GMT 2023
    - 1.7K bytes
    - Viewed (0)
  3. docs/ja/docs/tutorial/encoder.md

    同様に、このデータベースはPydanticモデル(属性を持つオブジェクト)を受け取らず、`dict`だけを受け取ります。
    
    そのために`jsonable_encoder`を使用することができます。
    
    Pydanticモデルのようなオブジェクトを受け取り、JSON互換版を返します:
    
    ```Python hl_lines="5 22"
    {!../../../docs_src/encoder/tutorial001.py!}
    ```
    
    この例では、Pydanticモデルを`dict`に、`datetime`を`str`に変換します。
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Mon Jan 22 20:09:02 GMT 2024
    - 1.9K bytes
    - Viewed (0)
Back to top