faker-jsonschema
[ Docs ]
faker-jsonschema is a Faker provider that generates random data conforming to a JSON Schema.
Pass any JSON Schema dict to faker.from_jsonschema() and get back a valid, randomly generated value.
1800+ unit and PBT tests aiming to ensure correctness. Limitations of our strategies are acknowledged in the docs.
Install
pip install faker-jsonschema
# or
uv add faker-jsonschema
Usage
from faker import Faker
from faker_jsonschema.provider import JSONSchemaProvider
fake = Faker()
fake.add_provider(JSONSchemaProvider)
schema = {
"type": "object",
"properties": {
"name": {"type": "string"},
"score": {"type": "integer", "minimum": 0, "maximum": 100},
"tags": {"type": "array", "items": {"type": "string"}, "maxItems": 3},
},
"required": ["name", "score"],
}
print(fake.from_jsonschema(schema))
# {'name': 'Doctor pass describe matter.', 'score': 8}
See the full documentation here.
Acknowledgements
This project exists because I have used joke2k's Faker lib many times at work and find it an invaluable tool in tests.
JSON Schema has some property specs defined as regex in JS syntax. So we need a way to translate those into Python/PCRE syntax that we can execute. We have vendored a fork of the now unmaintained Zac-HD/js-regex lib for that purpose, which unlocked that feature for us.
And then we needed a way to generate random values that match such a regex, for this we make use of the brilliant Hypothesis Property-based testing library, which has a handy from_regex() generation strategy. We also have some PBT tests using Hypothesis for its intended purpose.
Contributing
See MAINTAINER.md for development setup, common tasks, and release instructions.
Metadata
Release files for faker-jsonschema 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| faker_jsonschema-1.0.0.tar.gz | 144.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| faker_jsonschema-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 177.7 kB
Release files / faker_jsonschema-1.0.0.tar.gz
| Download URL | faker_jsonschema-1.0.0.tar.gz |
|---|---|
| Size | 144.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
db3d009b9022375e7192d98ca8a0cb2ffedecab90cbc6a7612bf8ea03f5f7db1
|
|
BLAKE2b-256 checksum How to use checksums |
1a8cdea5265a653d991a5b2193bcad60f2e350eb7e16381579ea5a69d9fd57bc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 7, 2026.
Transparency logRelease files / faker_jsonschema-1.0.0-py3-none-any.whl
| Download URL | faker_jsonschema-1.0.0-py3-none-any.whl |
|---|---|
| Size | 32.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
44438e8cd81f3826278027b7bfa1f3bb8f76b17da8c7e55a9723bc785b14a051
|
|
BLAKE2b-256 checksum How to use checksums |
4d6e1331a4a77d2829cbead07bf2c35f9d9f92dbec9b01cf46be47241151958f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 7, 2026.
Transparency log