Registry / type-stubs / types-simplejson

types-simplejson

JSON →
library4.1.0.20260724pypypi✓ verified 24d ago

types-simplejson is a stub package providing static type-checking annotations for the 'simplejson' library. It enables type checkers like MyPy and Pyright to analyze code that uses simplejson for JSON serialization and deserialization. This package is part of the broader typeshed project and currently aims to provide accurate annotations for simplejson version 3.20.*.

pip install types-simplejson
INSTALL
IMPORT
SIG · TYPES-SIMPLEJSON
T
types-simplejson
type-stubspythonv4.1.0.20260724
Install
1.6s avg
Import
Disk
65MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v4.1.0.20260724 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 66.7MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 1.6s · import 0.000s · 18MB
65MB installed
● package 65MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

simplejson-stubs
import simplejson_stubs
import simplejson-stubs

Demonstrates basic usage of `simplejson` with type hints provided by `types-simplejson`. The code serializes a dictionary to a JSON string and then deserializes it back to a dictionary, with type annotations for clarity and static analysis.

import simplejson from typing import Any, Dict, Union def serialize_and_deserialize(data: Dict[str, Union[str, int, bool]]) -> Dict[str, Any]: """ Serializes a dictionary to a JSON string and then deserializes it. """ json_string: str = simplejson.dumps(data, indent=2, sort_keys=True) print(f"Serialized JSON:\n{json_string}") deserialized_data: Dict[str, Any] = simplejson.loads(json_string) print(f"Deserialized data: {deserialized_data}") return deserialized_data if __name__ == "__main__": my_data = {"name": "Alice", "age": 30, "is_student": False} result = serialize_and_deserialize(my_data) assert result == my_data
Debug
Known issues
gotchaThe `types-simplejson` package provides *only* type-checking stubs. For actual runtime functionality, you *must* also install the `simplejson` library separately.
fix
Ensure `simplejson` is installed in your environment alongside `types-simplejson`: `pip install simplejson`.
affects: All versions
gotchaDo not attempt to import directly from `types_simplejson`. The imports for your code should always reference the `simplejson` library itself.
fix
Always use `import simplejson` (or `from simplejson import ...`) in your code. `types-simplejson` provides the type hints behind the scenes to your type checker.
affects: All versions
gotchaVersion compatibility between `types-simplejson` and the runtime `simplejson` library is crucial for accurate type checking. This stub package aims to provide accurate annotations for `simplejson==3.20.*`.
fix
Align your `simplejson` installation to match the version range specified by the `types-simplejson` metadata (e.g., `pip install 'simplejson>=3.20,<3.21'`).
affects: All versions of types-simplejson with corresponding simplejson versions
breakingThe `simplejson` library (version 3.19.1) introduced a breaking change by setting the default value of the `allow_nan` parameter in `dumps` and `dump` to `False`.
fix
If your application relies on serializing or deserializing `NaN`, `Infinity`, or `-Infinity` values, you must explicitly set `allow_nan=True` in your `simplejson.dumps()` or `simplejson.dump()` calls.
affects: simplejson >= 3.19.1
gotchaTypeshed stubs, including `types-simplejson`, are built and tested against specific Python versions. This package requires Python >=3.10 and is validated against Python versions 3.10 to 3.14.
fix
Ensure your project's Python interpreter is within the supported range (Python 3.10-3.14) to guarantee proper type-checking behavior and avoid unexpected errors.
affects: All versions
Upgrade
Version history
4.1.0.20260724latest on PyPI · released Jul 24, 2026
Audit
Dependencies
simplejsonrequiredThis package provides only type-checking stubs. The 'simplejson' library must be installed separately for runtime functionality.
Agent activity
39 hits · last 30 days
node
32
OpenAI (training)
1
Resources
types-simplejson — pip install types-simplejson · libregistry