Skip to content

Commit 5daf766

Browse files
authored
Added support for JSON with comments
1 parent 716860e commit 5daf766

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

.github/validate_json.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import json
1+
import jstyleson
22
import glob
33
import os
44
import sys
5-
import urllib.request
65

76
from ignore_json import ignore
87

@@ -11,14 +10,16 @@
1110
for filename in glob.glob(os.path.join('.', '*.json')):
1211
if filename not in ignore:
1312
print(f"Opening: {filename}")
14-
filecontent = open(filename, "r").read()
13+
14+
with open(filename, "r") as file:
15+
filecontent = file.read()
1516

1617
try:
17-
json.loads(filecontent)
18+
jstyleson.loads(filecontent)
1819
print(f"✅ JSON valid")
1920
except Exception as err:
2021
error = True
21-
print(f"❌ JSON invalid:")
22+
print(f"❌ JSON invalid in {filename}:")
2223
print(str(err))
2324

2425
if error:

0 commit comments

Comments
 (0)