I am working with GNU Emacs 23.1.1. When working with a .json file it is treated in the Fundamental mode:

enter image description here

How can I have the json file treated in the json mode?

I note that GNU Emacs 24.3.1 opens json files as Javascript which already allows formatting.

  • Does this answer your question? Make emacs automatically open binary files in hexl-mode
    – Drew
    Commented Feb 11, 2020 at 16:21
  • @Drew the difference between my question and emacs.stackexchange.com/questions/10277/… is technically involved therefore my question deserves a separate answer.
    – Viesturs
    Commented Feb 11, 2020 at 17:20
  • What have you tried to do? Explain why using Emacs-24.3 in javascript-mode is not good enough
    – Stefan
    Commented Feb 11, 2020 at 23:14
  • 1
    @Viesturs You could still install it as a container, an appimage or compile it from source yourself without root.
    – Qudit
    Commented Feb 12, 2020 at 17:10
  • 1
    @Viesturs - When installing or upgrading emacs on host is not a viable option, I use emacs+tramp on my local machine to login to remote host and edit the file remotely. For example, If I do C-x C-f /scp:username@remote-hostname:/path/to/file RET then emacs will login via SCP to remote-hostname as username and open /path/to/file inside emacs on my local machine. I use this feature everyday.
    – Melioratus
    Commented Feb 21, 2020 at 15:38

1 Answer 1


Install json-mode might be the simplest.

In my set up (I use straight.el)


(use-package json-mode)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.