#1012427 file: fails to detect JSON files with many levels

Package:
file
Source:
file
Description:
Recognize the type of data in a file using "magic" numbers
Submitter:
Vincent Lefevre
Date:
2026-01-10 11:40:09 UTC
Severity:
normal
Tags:
#1012427#5
Date:
2022-06-06 23:17:02 UTC
From:
To:
"file" fails to detect JSON files with many levels:

$ echo '{"a":{"b":{"c":{"d":[{"e":[{"f":{"g":[{"h":0}]}}]}]}}}}' | file -
/dev/stdin: ASCII text

This has been fixed upstream by increasing the number of allowed levels:
https://github.com/file/file/commit/6511e6f45a534551b0293e82a434e3cd6504066c

I've attached the corresponding patch without the changes in the
debug messages.

#1012427#10
Date:
2026-01-10 10:08:19 UTC
From:
To:
Es gibt eine Familienspende in Höhe von 1.850.000,00 USD von Cheng Charlie
Saephan. Bitte antworten Sie für weitere Informationen. Denken Sie daran,
Ihrer Familie und den Bedürftigen in Ihrer Umgebung Gutes zu tun.

Dies ist bereits der zweite Versuch, Sie zu erreichen. Bitte antworten Sie
für weitere Details.