ollama-json-fixer-python
Force local Ollama models to output strict, valid JSON. Zero dependencies beyond requests.
Problem
Local LLMs (Llama 3, Mistral, Qwen, Codellama) often wrap JSON in conversational text or markdown fences, breaking json.loads(). This causes JSONDecodeError in production pipelines.
Solution
- Auto-strips markdown fences
- Regex extraction of JSON blocks
- Auto-retry with strict system prompt
- Works with ANY Ollama model
- Single file - just copy and use
Quick Start
pip install requests
python ollama_json_fixer.py
Metadata
Release files for ollama-json-fixer 0.1.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 | Provenance | Actions |
|---|---|---|---|---|
| ollama_json_fixer-0.1.0.tar.gz | 3.1 kB | Without provenance | Details for ollama_json_fixer-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ollama_json_fixer-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for ollama_json_fixer-0.1.0-py3-none-any.whl |
Total release size: 6.3 kB
Release files / ollama_json_fixer-0.1.0.tar.gz
| Download URL | ollama_json_fixer-0.1.0.tar.gz |
|---|---|
| Size | 3.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eead9f4b75e92c7de5e12a17436a058363bc105f44f95f999e2a38d2b247c195
|
|
BLAKE2b-256 checksum How to use checksums |
a76cbf5d6af7a7c9bcc748476b017d18c687e0da8e5ff97ba5223268b28d7f30
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.6
|
Release files / ollama_json_fixer-0.1.0-py3-none-any.whl
| Download URL | ollama_json_fixer-0.1.0-py3-none-any.whl |
|---|---|
| Size | 3.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5d946defcb8666a437fc00b99bec517c24daa439d4e8f52c361aaccc05da34e1
|
|
BLAKE2b-256 checksum How to use checksums |
cff77c8fe96e1a1369501a4cd300accae7051e0a25a13ccbcbd55dda656aef9a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.6
|
Security for ollama-json-fixer 0.1.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.