Skip to content

code action to convert dict to TypedDict / dataclass / pydantic #2144

@asukaminato0721

Description

@asukaminato0721

Describe the Bug

https://stackoverflow.com/questions/62267544/generate-pydantic-model-from-a-dict

even a website for this

https://jsontopydantic.com/

usage:

I have code like this

def f():
    return {"a": 1, "b": [1, 2]}
class F(TypedDict):
    a: int
    b: list[int]

def f() -> F:
    return {"a": 1, "b": [1, 2]}

convert them to handle something like f()["a"]

Sandbox Link

No response

(Only applicable for extension issues) IDE Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    pydanticIssues related to support for Pydantic

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions