Skip to content

Commit

Permalink
[jsonla-] handle decoding errors in filetype guess
Browse files Browse the repository at this point in the history
  • Loading branch information
midichef committed May 28, 2024
1 parent 1a3b1e4 commit 9fe6adc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion visidata/loaders/jsonla.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ def guess_jsonla(vd, p):
return

if first_line.strip().startswith('['):
ret = json.loads(first_line)
try:
ret = json.loads(first_line)
except json.decoder.JSONDecodeError:
return
if isinstance(ret, list) and all(isinstance(v, str) for v in ret):
return dict(filetype='jsonla')

Expand Down

0 comments on commit 9fe6adc

Please sign in to comment.