jsonjqminify

How to increase depth limit of jq?


When trying to minify a deeply nested JSON file (~10k deep) using jq I got a parse error:

$ jq -c . <input.json >minified.json
parse error: Exceeds depth limit for parsing at line 227263, column 355

How can I increase the depth limit? Is there a command line option? I couldn't find anything about this in the man page.


Solution

  • If you're on a version lower than 1.8.0, upgrade jq to version 1.8.0 or higher (released June 2025).

    Version 1.8 increased the depth limit from 256 to 10,000 which should work in most cases.