# Best JSON command line spell checkers



## escape (May 14, 2017)

What are the best command line tools to check JSON syntax errors on program startup? 

best wishes, 

escape


----------



## pamdirac (May 16, 2017)

Probably you have to write you own script to do this.

something like this https://github.com/zaach/jsonlint


----------



## glocke (May 22, 2017)

You probably could use textproc/jq for this with the `--exit-status` argument. See https://stedolan.github.io/jq/manual/#Invokingjq

```
$ echo '{valid: true}' | jq -e; echo $?
parse error: Invalid numeric literal at line 1, column 7
4
$ echo '{"valid": true}' | jq -e; echo $?
{
  "valid": true
}
0
```


----------



## tobik@ (May 23, 2017)

devel/yajl comes with `json_verify` which can be used for syntax checking JSON files.

However if you want to get fancy and also verify that the file conforms to a given schema, devel/py-jsonschema (or any other validation tool from http://json-schema.org/implementations.html) is worth a look.


----------

