-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
Description
It would be helpful if the filename were included in parse error messages. While this could fairly easily be handled by a script, it would be nice if this functionality was included in jq
.
Example script
#!/usr/bin/env bash
set -e
for file in data/*.json; do
some_data=$(jq . file)
done
Currently, a parse error produces the following output.
$ ./parse_data.sh
parse error: Expected another key-value pair at line 20, column 3
It would be helpful if it output something like this.
$ ./parse_data.sh
Error parsing file data/2017-10-data.json: Expected another key-value pair at line 20, column 3
Even better, this feature could be added behind a --verbose
flag and include the context of the error.
$ ./parse_data.sh
Error parsing file data/2017-10-data.json:
19 | "name": "Bob Smith",
> 20 | },
^
21 | {
Expected another key-value pair at line 20, column 3
chbrown, stuarthicks, robertofilho-ctl, shd4, vithnilica and 14 more