paul paul - 1 year ago 105
Bash Question

JQ issues with comments on Json file

i´m using JQ to work in bash with my json and when I read the json is throwing me an error

parse error: Invalid numeric literal at line 2, column 5=

Since my json has some comments

// comment
"spawn": {}

Iñve been seen looking the options and I cannot find any option to fix the problem.
Any idea how to solve it?

Answer Source

JSON and thus jq do not support comments (in the usual sense). The jq FAQ lists a number of tools that can be used to remove comments, including jsonlint, json5, and any-json. I'd recommend one that can act as a filter.

See for links and further details.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download