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
muslpy 3.10–3.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 66.7MB
glibcpy 3.10–3.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.fixEnsure `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.fixAlways 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.*`.fixAlign 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`.fixIf 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.fixEnsure 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.