Closed MoonJustry closed 3 years ago
There is no magic file signature for JSON files in the XDG shared-mime-info database, it only matches by glob (*.json). Since JSON isn't a regular language, it can't be trivially ascertained using byte-by-byte comparisons and searches. Here's how file/libmagic does it. If you'd like to work on porting that code to Go, mimemagic could be trivially extended to implement the same functionality.
json data like
but Match result is text/plain