Currently json-mode uses magic-mode-alist for mode detection. This list is prioritized over auto-mode-alist so it causes problems when a file starts with a either { or [ but isn't actually JSON.
Emacs provides magic-fallback-mode-alist which is essentially the same thing as magic-mode-alist, but is checked after auto-mode-alist. In a fresh install of emacs, it's used for detecting things like html/xml, so this seems like it would be a better fit for json-mode.
See Choosing Modes in the emacs manual for more details.
Currently json-mode uses
magic-mode-alist
for mode detection. This list is prioritized overauto-mode-alist
so it causes problems when a file starts with a either{
or[
but isn't actually JSON.Emacs provides
magic-fallback-mode-alist
which is essentially the same thing asmagic-mode-alist
, but is checked afterauto-mode-alist
. In a fresh install of emacs, it's used for detecting things like html/xml, so this seems like it would be a better fit for json-mode.See Choosing Modes in the emacs manual for more details.