Skip to main content

Parse incomplete or partial json

Project description

PartialJson

Partialjson

Parse Partial and incomplete JSON in python

Parse Partial and incomplete JSON in python with just 3 lines of python code.

PyPI version Supported Python versions Downloads

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

Star History Chart

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.

  1. Fork the repo on GitHub
  2. Clone the project to your own machine
  3. Update the Version inside init.py
  4. Commit changes to your own branch
  5. Push your work back up to your fork
  6. Submit a Pull request so that we can review your changes

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

partialjson-1.0.0.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

partialjson-1.0.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

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

Hashes for partialjson-1.0.0.tar.gz
Algorithm Hash digest
SHA256 e1624f682ac79ac4d9bc384b467a62b7b28f4c83d6c153825314ae9d35f0a2a5
MD5 db4ce69d0153912f768f54477020f97a
BLAKE2b-256 3041e8d67067b50a87955640e481cf0e53bc2017b09a3b287e567395ff637a56

See more details on using hashes here.

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

Hashes for partialjson-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b00b5f02c3ff890e087274298da2fe361d4c4c863536d4e360a1d777418a67c9
MD5 b829ebb82b662c46ee8cd1f27f199b07
BLAKE2b-256 7547f7f019a07026ad6d5480694c23888ca87daf800bc79e20ea97f43fd5faa1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page