Skip to content

Add json types to _typeshed? #5910

Closed as not planned
Closed as not planned
@srittau

Description

@srittau

As this is an issue that pops up quite often and would be useful in a few places in typeshed as well: Should we add json types to _typeshed? As recursive types aren't possible at the moment, I'd suggest something simple like this:

JsonObject = dict[str, Any]  # Any is Json
JsonArray = list[Any]  # Any is Json
Json = JsonObject | JsonArray | str | float | int | bool | None

This can be improved if recursive types become available and could be a useful placeholder if/when the stdlib gains a proper JSON type.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions