diff --git a/pysubs2/formats/jsonformat.py b/pysubs2/formats/jsonformat.py index 85f37c7..2f9acc5 100644 --- a/pysubs2/formats/jsonformat.py +++ b/pysubs2/formats/jsonformat.py @@ -27,7 +27,7 @@ class JSONFormat(FormatBase): @classmethod def guess_format(cls, text: str) -> Optional[str]: """See :meth:`pysubs2.formats.FormatBase.guess_format()`""" - if text.startswith("{\"") and "\"info:\"" in text: + if text.startswith("{\"") and "\"info\":" in text: return "json" else: return None diff --git a/tests/formats/test_json.py b/tests/formats/test_json.py index 26a6b1d..094d112 100644 --- a/tests/formats/test_json.py +++ b/tests/formats/test_json.py @@ -17,8 +17,10 @@ def test_write_read() -> None: json_text = subs.to_string("json") subs2 = SSAFile.from_string(json_text, "json") + subs3 = SSAFile.from_string(json_text) assert subs2.equals(subs) + assert subs3.equals(subs) def test_read_unsupported_json_issue_85() -> None: