Galuh Sahid
commited on
Commit
•
9658f76
1
Parent(s):
7db109e
Check json
Browse files- data/check_json.py +18 -0
data/check_json.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import json
|
2 |
+
import sys
|
3 |
+
|
4 |
+
file_name = sys.argv[1]
|
5 |
+
|
6 |
+
with open(file_name, 'r') as json_file:
|
7 |
+
json_list = list(json_file)
|
8 |
+
|
9 |
+
for json_str in json_list:
|
10 |
+
try:
|
11 |
+
result = json.loads(json_str)
|
12 |
+
# print(f"result: {result}")
|
13 |
+
|
14 |
+
if not isinstance(result, dict):
|
15 |
+
print(json_str)
|
16 |
+
except Exception as e:
|
17 |
+
print(json_str)
|
18 |
+
print(e)
|