Novice - Interpretate JSON files.
-
I want to make sense of some JSON files, and a Google search suggested that Notepad++ was ideal.
I’ve added in the extensions for JSON files and imported a couple of files. To me the result looks like an HTML type structure (but as the subject line suggests, I don’t really have a clue. I thought that the JSON viewer would make it look tidier.
Could someone, please, in simple terms explain how I process a file to get a more readable format.
Thank you.
-
@Tom-Gardner said:
explain how I process a (json) file to get a more readable format.
It’s not a Notepad++ topic, and thus it is out-of-bounds for discussion on this forum.
-
in simple terms explain how I process a file to get a more readable format.
It depends on what you think of as more readable.
If you JSON is compressed all onto one line, then the JsonTools plugin has the Pretty-print current JSON file, which is “more readable” than if it’s all on one line.
JsonTools also has the Open JSON tree viewer, which brings up a separate panel which helps you navigate through the data – and that’s “more readable”
I believe that NppJsonViewer also has similar commands, but it’s not on my current installation, so I cannot check for you.
But JSON is a specific structured data format, so if by “more readable”, you mean, “convert from the JSON format to some data structure I like more”, then Notepad++ isn’t likely to have a tool for that – As described in this FAQ, Notepad++'s regular expression search/replace isn’t really a good idea for converting generic JSON into some other format, or otherwise manipulating JSON, because there are too many edge cases to easily get into a regular expression. Any good converter from JSON to something else is more likely to be a standalone converter utility, which is (as Alan said) off topic for a Notepad++ forum.
-
As the OP had said
I’ve added in the extensions for JSON files
I took that to mean he was looking for Notepad++ to further help him understand the data (it really can’t), or someone here to post in an off-topic manner to give him help.
-
@Tom-Gardner said in Novice - Interpretate JSON files.:
Could someone, please, in simple terms explain how I process a file to get a more readable format.
If all this looks like too much to read, please see the last sentence in this post, which is likely to be the most useful one.
That depends on what the JSON files are for. JSON is just a set of rules for storing data so that a computer program can read it. Like some other formats (e.g., CSV and XML), it’s designed so that a human being can kinda, sorta read and edit it if that human knows the expectations of the software for which it is made.
Notepad++ can indeed do that — view and/or edit JSON if you already understand how it is structured and how the programs that read and write it use it — but neither Notepad++ nor any other application can make just any arbitrary JSON file comprehensible to a “normal person.”
There is a plugin for Notepad++ called JsonTools, written @Mark-Olson, which can help search and manipulate JSON files, but I don’t think it can convert it to another format. You can install it from Plugins | Plugins Admin… in Notepad++ (find it in the list on the Available tab, check the box, and click Install at the top right).
A Google search for JSON to csv will turn up some options — I haven’t used any of them, so I don’t know how they work. CSV is a format typically used by spreadsheets, so if your JSON file is amenable to conversion and if you are comfortable with spreadsheet software, that might be an option for you.
Otherwise, and maybe anyway, you’ll need to look for information from people who are familiar with the software that produced the files.
-
@Coises
Thanks for mentioning JsonTools! JsonTools can convert JSON to CSV’s (there’s actually a whole JSON to CSV form), and there’s the RemesPath query language for manipulating JSON into other JSON.When I first read @Tom-Gardner’s post I didn’t read it very carefully and I thought he wanted to convert the JSON into HTML, which is not something JsonTools can do. But it may be that JsonTools can help him with his use case. Maybe if he explains more of what he’s looking for, I can help.
By the way, I have a section in my README about the advantages and disadvantages of JsonTools compared to JSON-Viewer and JSTool, but in short, I would use JsonTools over any of those other plugins unless you care about performance of reformatting very large files (say 50+ MB). By any other metric I would say JsonTools is better, including performance of the tree view.
-
@Alan-Kilborn said in Novice - Interpretate JSON files.:
I took that to mean he was looking for Notepad++ to further help him understand the data (it really can’t)
I mean, JsonTools does have fairly comprehensive support for JSON Schema, so if by
understand the data
you mean “create a schema that compactly represents the structure of your file and then validate other JSON files against that schema”, JsonTools can absolutely do that.