Skip to content

Implement json.pyi for Python's stdlib #84

Closed

Description

@brettcannon

See python/typing#182 for the discussion. The resulting type of things should be JSONType = t.Union[str, int, float, bool, None, t.Dict[str, t.Any], t.List[Any]] (which should end up in Python 3.6: http://bugs.python.org/issue26396).

Activity

  1. gvanrossum commented on Mar 22, 2016

    @gvanrossum
    Member

    Feel free to add this to the existing stdlib/3/json.pyi stub. Technically it should probably go in the 3.6 version -- you'd have to create a 3.6 subdir, copy json.pyi into it, and then add JSONType there. But we're not very strict about these things, and lots of other modules in stdlib/3 have features that aren't available in all versions from 3.2--3.6. At runtime people can use a trick like

    if False:
        from json import JSONType

    This way they can use JSONType and still run their code under 3.2--3.5. This would actually suggest that it's better not to introduce a separate 3.6 version. We should also add it to the 2.7. version.

  2. added a commit that references this issue on Jul 5, 2016
  3. JelleZijlstra commented on Apr 23, 2017

    @JelleZijlstra
    Member

    The json stubs in typeshed are fine and the typing issue for adding JSONType was closed with no action, so I don't think there's anything to do here. (Feel free to reopen if you disagree.)

  4. added a commit that references this issue on May 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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