Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

JSON Syntax Checker

这是一个简单的 JSON 语法检查器。

使用方法

python json_checker.py your_file.json

也可以直接把 JSON 文件拖到终端窗口里,然后放开鼠标即可。

  • 如果 JSON 正确,输出:Valid JSON: your_file.json
  • 如果 JSON 错误,会输出:
    • 错误原因
    • 行号和列号
    • 带高亮的源码行
    • 指向问题位置的 ^ 标记
  • 返回码:
    • 0: 有效 JSON
    • 1: 无效 JSON 或文件错误

示例

python json_checker.py sample_valid.json
python json_checker.py sample_invalid.json

输出会类似:

Invalid JSON in sample_invalid.json
Reason: Expecting value at line 1, column 21
   1 | {"name": "Alice",}
                         ^

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages