Parse incomplete or partial json
Project description
PartialJson
Parse Partial and incomplete JSON in python
Parse Partial and incomplete JSON in python with just 3 lines of python code.
Example
from partialjson.json_parser import JSONParser
parser = JSONParser()
incomplete_json = '{"name": "John Doe", "age": 30, "is_student": false, "courses": ["Math", "Science"'
print(parser.parse(incomplete_json))
# {'name': 'John', 'age': 30, 'is_student': False, 'courses': ['Math', 'Science']}
Problem with \n? strict mode is here
from partialjson.json_parser import JSONParser
parser = JSONParser(strict=False)
incomplete_json = '{"name": "John\nDoe", "age": 30, "is_student": false, "courses": ["Math", "Science"'
print(parser.parse(incomplete_json))
# {'name': 'John\nDoe', 'age': 30, 'is_student': False, 'courses': ['Math', 'Science']}
Installation
$ pip install partialjson
Also can be found on pypi
How can I use it?
- Install the package by pip package manager.
- After installing, you can use it and call the library.
Testing
pip install -e .
pip install -r requirements-dev.txt
pytest -q
Citation
If you use this software, please cite it using the metadata in CITATION.cff.
Star History
Issues
Feel free to submit issues and enhancement requests or contact me via vida.page/nima.
Contributing
Please refer to each project's style and contribution guidelines for submitting patches and additions. In general, we follow the "fork-and-pull" Git workflow.
- Fork the repo on GitHub
- Clone the project to your own machine
- Update the Version inside init.py
- Commit changes to your own branch
- Push your work back up to your fork
- Submit a Pull request so that we can review your changes
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file partialjson-1.0.0.tar.gz.
File metadata
- Download URL: partialjson-1.0.0.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e1624f682ac79ac4d9bc384b467a62b7b28f4c83d6c153825314ae9d35f0a2a5
|
|
| MD5 |
db4ce69d0153912f768f54477020f97a
|
|
| BLAKE2b-256 |
3041e8d67067b50a87955640e481cf0e53bc2017b09a3b287e567395ff637a56
|
File details
Details for the file partialjson-1.0.0-py3-none-any.whl.
File metadata
- Download URL: partialjson-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b00b5f02c3ff890e087274298da2fe361d4c4c863536d4e360a1d777418a67c9
|
|
| MD5 |
b829ebb82b662c46ee8cd1f27f199b07
|
|
| BLAKE2b-256 |
7547f7f019a07026ad6d5480694c23888ca87daf800bc79e20ea97f43fd5faa1
|