Use Notepad++ As Offline JSON Validator

As software developers we encounter JSON format frequently, especially if we are into developing web apps. It is a common format for REST API payload. Or there are NoSQL databases like MongoDB which store JSON documents. Parsing & figuring out details from large JSON documents is a regular thing. How do we generally do that? There are multiple online websites which do exactly that. They take unformatted JSON text, parse it, do validation & show the formatted JSON back to the user. We can even collapse or expand different sub-sections of the JSON text conveniently. But not all the JSON parsing/formatting online tools are good. Frequently we can see performance issues when we try to parse a decent size JSON document maybe sized several megabytes. The challenge is that these websites do parsing mostly in client side. So our JSON text won’t be sent to server where it can be processed & parsed. It can’t leverage the resources of the server. Instead client side code like JavaScript will parse the JSON text within browser. So the processing directly consumes memory allocated to your browser. And if the JavaScript code is not well written, your browser might hang. Obviously there are few websites which are popular & perform this task pretty well & efficiently. I use https://jsonlint.com/ & http://jsonviewer.stack.hu/ frequently. They work well. I personally find http://jsonviewer.stack.hu/ to be more performant while parsing large JSON files. Mostly it is sufficient.

So why should we bother about having an offline JSON validator or parser? I would like to point out a couple of things, though these mostly depend on personal use cases or choice. We are using online websites & submitting our document to some form where it is getting parsed. As I mentioned, mostly this parsing is done in client side. But do we really check & verify whether the website is making a network call & posting the document to their server? We need to be careful about that when we need to parse sensitive data something that belongs to real user. Otherwise some website can store the sensitive data & get access to it. I am not saying all of them do that, but you never know unless you verify. It’s better if you can do it offline without needing any network. Another thing is your browser does hang if you try to parse large JSON document maybe in 10s of megabytes. Generally we don’t have such a large JSON file. But time to time you may encounter this problem. That’s when you need a robust software which can do the job & doesn’t hang any other apps.

I mostly work in Windows & use NotePad++ to quickly note things down or to read documents. Notepad++ software works well in handling big text documents. It doesn’t hang while opening or scrolling large documents. Notepad++ has a pretty useful plugin which can be installed to parse & validate JSON documents. Once installed, you can validate & view the JSON in tree structure without any internet. It works well with large JSON documents which might be in 10s of megabytes. Also you can select JSON fragment from a mixed document & only format that. You can enter “Ctrl+Alt+Shift+J” after selecting the text or go to plugins > JSON Viewer > show JSON Viewer option.

If text is not a valid JSON, you will get error.

Overall it is a pretty good tool which I have used. You might find it handy.

2 thoughts on “Use Notepad++ As Offline JSON Validator”

    • It validates whether the text is in proper JSON format. But it doesn’t validate against a specific schema. I don’t think other websites that I mentioned has this feature either.

      Reply

Leave a Comment