diff --git a/README.md b/README.md index 3eee3d5..342b2c2 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,12 @@ # PartialJson -## Parse Partial and incomplete JSON in python - [![Partialjson](https://github.com/iw4p/partialjson/raw/main/images/partialjson.png )](https://pypi.org/project/partialjson/) +## Parse Partial and incomplete JSON in python + +![](https://github.com/iw4p/partialjson/raw/main/images/partialjson.gif) + ### Parse Partial and incomplete JSON in python with just 3 lines of python code. [![PyPI version](https://img.shields.io/pypi/v/partialjson.svg)](https://pypi.org/project/partialjson) diff --git a/example.py b/example.py new file mode 100644 index 0000000..10e0670 --- /dev/null +++ b/example.py @@ -0,0 +1,15 @@ +from partialjson.json_parser import JSONParser +import time, sys + +parser = JSONParser() + +incomplete_json = '{"name": "John", "age": 18, "family":' + +json = "" + +for char in incomplete_json: + json += char + print(f'\nIncomplete or streaming json:\n{json}') + print(f'Final and usable JSON without crashing:\n{parser.parse(json)}') + sys.stdout.flush() + time.sleep(0.3) \ No newline at end of file diff --git a/images/partialjson.gif b/images/partialjson.gif new file mode 100644 index 0000000..0a4e3d7 Binary files /dev/null and b/images/partialjson.gif differ