Skip to content

Commit

Permalink
ref: init
Browse files Browse the repository at this point in the history
  • Loading branch information
iw4p committed Nov 24, 2023
1 parent 12b38d0 commit 0448a82
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 10 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# PartialJson

## Parse Partial and incomplete JSON in python

## Example
```python
import json
from partialjson.json_parser import JSONParser
parser = JSONParser()

incomplete_json = '{"name": "John", "age": 30, "is_student": false, "courses": ["Math", "Science"'
print("Testing with incomplete JSON string:", parser.parse(incomplete_json))
```
19 changes: 19 additions & 0 deletions partialjson/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
"""
torrentp.
A great wrapped library for downloading from torrent.
"""
from .json_parser import JSONParser

__version__ = "0.0.1"
__author__ = 'Nima Akbarzadeh'
__author_email__ = "[email protected]"
__license__ = "MIT"
__url__ = "https://github.com/iw4p/partialjson"

PYPI_SIMPLE_ENDPOINT: str = "https://pypi.org/project/partialjson"

__all__ = [
"JSONParser",
"PYPI_SIMPLE_ENDPOINT",
]
9 changes: 0 additions & 9 deletions partialjson/json_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,3 @@ def parse_null(self, s, e):
return None, s[4:]
raise e

# Test

parser = JSONParser()

json_string = '{"name": "John", "age": 30, "is_student": false, "courses": ["Math", "Science"]}'
print("Testing with valid JSON string:", parser.parse(json_string))

incomplete_json = '{"name": "John", "age": 30, "is_student": false, "courses": ["Math", "Science"'
print("Testing with incomplete JSON string:", parser.parse(incomplete_json))
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def get_property(prop):
setup(
name='partialjson',
version=get_property('__version__'),
description='Parse incompleted or partial json',
description='Parse incomplete or partial json',
long_description=README,
long_description_content_type="text/markdown",
url=get_property('__url__'),
Expand Down

0 comments on commit 0448a82

Please sign in to comment.