Emacs 26.1. Windows 10

It's has function json-pretty-print . But it not enough for me. Has any another better json formater and validator? I mean the next.

Suppose I has error on json on line 26. I missed ",". But json-pretty-print get me strange error message:

Json readtable error: 93

enter image description here

I don't understand this message. What does it mean? Why simple not get message something like this:

Error: Parse error on line 26:
...n1_FR"           }       ]   }   "loyalty": true,    "u
Expecting 'EOF', '}', ',', ']', got 'STRING'

So that is the reason why I need better json validator and formater.

  • I update my post with explain what I mean "good". Commented Nov 17, 2018 at 13:06

1 Answer 1


I'm really curious about why you feel json-pretty-print is not good enough.

Perhaps you don't like needing to call it manually? You could set it to run whenever you save the file:

 (lambda ()
   (add-hook 'before-save-hook 'json-pretty-print-buffer t t)))

If you'd still like an alternative, I highly recommend prettier-mode. It's a minor mode that runs the file through prettier on save. In circumstances with invalid JSON it does give you diagnostic output (but does not enforce strict JSON AFAIK. For example:

prettier errors:
[error] stdin: SyntaxError: Unexpected token, expected "," (4:7)
[error]   2 |   "foo": {
[error]   3 |       "bar": "baz"
[error] > 4 |       "blah": "blooh"
[error]     |       ^
[error]   5 |   }
[error]   6 | }
[error]   7 | 
  • I updated my post. Commented Nov 17, 2018 at 13:07
  • I install prettier-mode. How I can validate json? What is the command for this? Commented Nov 18, 2018 at 10:47
  • Emacs 26.1, Windows 10. Commented Nov 18, 2018 at 18:18

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.