partialjson 0.0.2__tar.gz → 0.0.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {partialjson-0.0.2 → partialjson-0.0.4}/PKG-INFO +5 -3
- {partialjson-0.0.2 → partialjson-0.0.4}/README.md +4 -2
- {partialjson-0.0.2 → partialjson-0.0.4}/partialjson/__init__.py +1 -1
- {partialjson-0.0.2 → partialjson-0.0.4}/partialjson/json_parser.py +11 -8
- {partialjson-0.0.2 → partialjson-0.0.4}/partialjson.egg-info/PKG-INFO +5 -3
- {partialjson-0.0.2 → partialjson-0.0.4}/LICENSE +0 -0
- {partialjson-0.0.2 → partialjson-0.0.4}/partialjson.egg-info/SOURCES.txt +0 -0
- {partialjson-0.0.2 → partialjson-0.0.4}/partialjson.egg-info/dependency_links.txt +0 -0
- {partialjson-0.0.2 → partialjson-0.0.4}/partialjson.egg-info/top_level.txt +0 -0
- {partialjson-0.0.2 → partialjson-0.0.4}/setup.cfg +0 -0
- {partialjson-0.0.2 → partialjson-0.0.4}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: partialjson
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.4
|
|
4
4
|
Summary: Parse incomplete or partial json
|
|
5
5
|
Home-page: https://github.com/iw4p/partialjson
|
|
6
6
|
Author: Nima Akbarzadeh
|
|
@@ -11,11 +11,13 @@ License-File: LICENSE
|
|
|
11
11
|
|
|
12
12
|
# PartialJson
|
|
13
13
|
|
|
14
|
-
## Parse Partial and incomplete JSON in python
|
|
15
|
-
|
|
16
14
|
[](https://pypi.org/project/partialjson/)
|
|
18
16
|
|
|
17
|
+
## Parse Partial and incomplete JSON in python
|
|
18
|
+
|
|
19
|
+

|
|
20
|
+
|
|
19
21
|
### Parse Partial and incomplete JSON in python with just 3 lines of python code.
|
|
20
22
|
|
|
21
23
|
[](https://pypi.org/project/partialjson)
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
# PartialJson
|
|
2
2
|
|
|
3
|
-
## Parse Partial and incomplete JSON in python
|
|
4
|
-
|
|
5
3
|
[](https://pypi.org/project/partialjson/)
|
|
7
5
|
|
|
6
|
+
## Parse Partial and incomplete JSON in python
|
|
7
|
+
|
|
8
|
+

|
|
9
|
+
|
|
8
10
|
### Parse Partial and incomplete JSON in python with just 3 lines of python code.
|
|
9
11
|
|
|
10
12
|
[](https://pypi.org/project/partialjson)
|
|
@@ -25,14 +25,17 @@ class JSONParser:
|
|
|
25
25
|
print('Parsed JSON with extra tokens:', {'text': text, 'data': data, 'reminding': reminding})
|
|
26
26
|
|
|
27
27
|
def parse(self, s):
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
self.on_extra_token
|
|
35
|
-
|
|
28
|
+
if len(s) >= 1:
|
|
29
|
+
try:
|
|
30
|
+
return json.loads(s)
|
|
31
|
+
except json.JSONDecodeError as e:
|
|
32
|
+
data, reminding = self.parse_any(s, e)
|
|
33
|
+
self.last_parse_reminding = reminding
|
|
34
|
+
if self.on_extra_token and reminding:
|
|
35
|
+
self.on_extra_token(s, data, reminding)
|
|
36
|
+
return json.loads(json.dumps(data))
|
|
37
|
+
else:
|
|
38
|
+
return json.loads({})
|
|
36
39
|
|
|
37
40
|
def parse_any(self, s, e):
|
|
38
41
|
if not s:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: partialjson
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.4
|
|
4
4
|
Summary: Parse incomplete or partial json
|
|
5
5
|
Home-page: https://github.com/iw4p/partialjson
|
|
6
6
|
Author: Nima Akbarzadeh
|
|
@@ -11,11 +11,13 @@ License-File: LICENSE
|
|
|
11
11
|
|
|
12
12
|
# PartialJson
|
|
13
13
|
|
|
14
|
-
## Parse Partial and incomplete JSON in python
|
|
15
|
-
|
|
16
14
|
[](https://pypi.org/project/partialjson/)
|
|
18
16
|
|
|
17
|
+
## Parse Partial and incomplete JSON in python
|
|
18
|
+
|
|
19
|
+

|
|
20
|
+
|
|
19
21
|
### Parse Partial and incomplete JSON in python with just 3 lines of python code.
|
|
20
22
|
|
|
21
23
|
[](https://pypi.org/project/partialjson)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|