This project is a branch of jiter on QPython.
This is a standalone version of the JSON parser used in pydantic-core. The recommendation is to only use this package directly if you do not use pydantic.
Examples
The main function provided by Jiter is from_json(), which accepts a bytes object containing JSON and returns a Python dictionary, list or other value.
from jiter import from_json
json_data = b'{"name": "John", "age": 30}'
parsed_data = jiter.from_json(json_data)
print(parsed_data) # Output: {'name': 'John', 'age': 30}
Handling Partial JSON
Incomplete JSON objects can be parsed using the partial_mode= parameter.
import jiter
partial_json = b'{"name": "John", "age": 30, "city": "New Yor'
# Raise error on incomplete JSON
try:
jiter.from_json(partial_json, partial_mode=False)
except ValueError as e:
print(f"Error: {e}")
# Parse incomplete JSON, discarding incomplete last field
result = jiter.from_json(partial_json, partial_mode=True)
print(result) # Output: {'name': 'John', 'age': 30}
# Parse incomplete JSON, including incomplete last field
result = jiter.from_json(partial_json, partial_mode='trailing-strings')
print(result) # Output: {'name': 'John', 'age': 30, 'city': 'New Yor'}
Release files for jiter-qpython 0.7.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 | |
|---|---|---|---|
| jiter_qpython-0.7.0.tar.gz | 360.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| jiter_qpython-0.7.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 721.2 kB
Release files / jiter_qpython-0.7.0.tar.gz
| Download URL | jiter_qpython-0.7.0.tar.gz |
|---|---|
| Size | 360.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
456e9fd0838dd20f6f0ac5aa4a01a7be95048ba0885026ba7001eb135e8c350e
|
|
BLAKE2b-256 checksum How to use checksums |
b40442b08d46cb4979cd7315df7e21671a8db5e202419b9c19b3c21ffc2fca1b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.7
|
Release files / jiter_qpython-0.7.0-py3-none-any.whl
| Download URL | jiter_qpython-0.7.0-py3-none-any.whl |
|---|---|
| Size | 360.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5aceb00f128d5d4bb64e9487fa8f7c7678a395602306a5c100bf1080fcc64100
|
|
BLAKE2b-256 checksum How to use checksums |
4a2bccf518a8e8805367dfd3e7d390a5618ee66688234ae3e7b9d4ce1078cd39
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.7
|