Hugging Face
Models
Datasets
Spaces
Posts
Docs
Solutions
Pricing
Log In
Sign Up
Spaces:
linpershey
/
sheetbot
like
0
Runtime error
App
Files
Files
Community
60274d1
sheetbot
/
utils.py
linpershey
add sonnet support
60274d1
5 months ago
raw
Copy download link
history
blame
220 Bytes
import
json
def
parse_json_garbage
(
s
):
s = s[
next
(idx
for
idx, c
in
enumerate
(s)
if
c
in
"{["
):]
try
:
return
json.loads(s)
except
json.JSONDecodeError
as
e:
return
json.loads(s[:e.pos])