Skip to content

Commit

Permalink
doc(README): strict mode example
Browse files Browse the repository at this point in the history
  • Loading branch information
iw4p committed Aug 3, 2024
1 parent 9f0a02d commit 7a04b32
Showing 1 changed file with 26 additions and 12 deletions.
38 changes: 26 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# PartialJson

[![Partialjson](https://github.com/iw4p/partialjson/raw/main/images/partialjson.png
)](https://pypi.org/project/partialjson/)
[![Partialjson](https://github.com/iw4p/partialjson/raw/main/images/partialjson.png)](https://pypi.org/project/partialjson/)

## Parse Partial and incomplete JSON in python

Expand All @@ -13,41 +12,56 @@
[![Supported Python versions](https://img.shields.io/pypi/pyversions/partialjson.svg)](#Installation)
[![Downloads](https://pepy.tech/badge/partialjson)](https://pepy.tech/project/partialjson)


## Example

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

incomplete_json = '{"name": "John", "age": 30, "is_student": false, "courses": ["Math", "Science"'
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

```python
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

```sh
$ pip install partialjson
```

Also can be found on [pypi](https://pypi.org/project/partialjson/)

### How can I use it?
- Install the package by pip package manager.
- After installing, you can use it and call the library.

- Install the package by pip package manager.
- After installing, you can use it and call the library.

## Star History

[![Star History Chart](https://api.star-history.com/svg?repos=iw4p/partialjson&type=Date)](https://star-history.com/#iw4p/partialjson&Date)

### Issues

Feel free to submit issues and enhancement requests or contact me via [vida.page/nima](https://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
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

0 comments on commit 7a04b32

Please sign in to comment.