If you’ve ever done stuff like personal accounting on Excel, then you’ve probably felt this problem: the more info you store, the harder it is to update things. As your data gets larger, everything becomes messy and weird. Databases are nice and all, but they’re not exactly as “readable” as most of us would want them to be. Good thing there’s JSON to help us out.
What Is a JSON File?
JSON stands for JavaScript Object Notation and it’s used in defining objects in JavaScript. Of course, you don’t have to learn JavaScript to understand JSON. It is simply a format for grouping data so it is easier to read and format.
Give this example a glance and find the names of each pet:
{ "pets": [ { "type": "dog", "name": "Maddogna", "breed": "Golden Retriever", "age": 3, "likes": ["barking", "going for walks", "Fluffman"], "dislikes": ["loud noises", "strangers"] }, { "type": "cat", "name": "Fluffman", "breed": "Siamese", "age": 3, "likes": ["napping", "being petted"], "dislikes": ["being picked up", "Maddogna", "dog food"] }, { "type": "iguana", "name": "Gizzards the Great", "breed": "Green Iguana", "age": 2, "likes": ["sunbathing", "watching Fluffman and Maddogna"], "dislikes": ["cold weather", "being stared at by Fluffman and Maddogna"] } ] }
It’s like a list of things. And you could easily see the pets’ names: Maddogna, Fluffman, and Gizzards the Great. Among them are other data like their age, dislikes, and breed.
JSON bridges the gap between computers and normal humans when it comes to data. It’s quick, understandable, and can be converted into any other format you need your data to look like.
JSON files shine the best when it comes to converting large amounts of data.
What is JSON Used For
JSON is a format. You can send almost anything with it. As long as you are sending compiled data, JSON can be used. In fact, your computer is probably using it right now to talk to other computers across the globe without you knowing it.
There are plenty of uses for JSON, such as:
- Instant messages
- Emails
- Configuration files
- Networking information
You can also see JSON in games during development and release to store your saves and settings.
Of course, there are other faster ways to move data around, but JSON is just too convenient to let up.
How to Open a JSON File
At their very core, JSON files are really just text files saved with a “.json” extension. You can open them with any kind of plain-text editor as if they were an ordinary text file.
- In Windows, open Notepad and go to “File -> Open” then look for the JSON file you are trying to open.
Tip: If the file doesn’t seem to show up, click on the drop down that says “Text Documents (*.txt)” and choose the “All Files” option.
- If there’s something you want to look up within the file, just press Ctrl + F then type what you need to find.
- If you want to make a new JSON file, just make a regular text file and save it with a “.json” file extension. Be sure to change the save type to “All Files” or else it’ll turn into “filename.json.txt” instead.
Tip: To open JSON files in macOS and Linux, you can make use of the default text editor to open and view JSON files.
Using JSON Viewers
Now while useful, the problem with those online converters is that they aren’t handy when you’re doing web-based tasks. Luckily, there are different kinds of JSON viewers that not only can help you convert JSON files, but also let you better read their contents minus the headaches!
JSON Lite
JSON Lite (Chrome|Firefox) is a browser extension that makes it much easier to view and edit JSON files on any Chrome-based browser. It highlights parts of the JSON code with different colors. And if the default look isn’t “visible” enough, you can change the settings for indentation, collapse lines, and even set it up for dark mode.
Alternatively, you can also use these JSON beautifers to make the data more easier to view.
Converting JSON File
Depending on what you’re using the JSON file for, you might need to use a converter to change it into CSV or XML file.
To do this, you can use a JSON converter like the Code Beautify JSON Viewer. This is a web app that converts JSON files to either CSV or XML, which can then be used by other software.
To use the Code Beautify JSON Viewer, just upload your file by clicking on the “File” button then convert by clicking either “to XML” or “to CSV.”
Frequently Asked Questions
Is JSON better than CSV and XML?
Compared to CSV and XML, JSON files are simpler, more flexible, and easier for a computer to interpret. For the most part, it lets you store data structures as is. Unlike in XML, you don’t have to add tags saying that a 1 is a number and not a string containing the number 1. It’s also capable of having complex data structures, unlike CSV which needs you to add NULL every time you have some extra “cells” on your data.
Is JSON a programming language?
JSON is NOT a programming language, but it is certainly used within a programming language. JSON is based on JavaScript which uses it to define things called “objects” in that language. It’s a notation format for listing down things – you can’t do anything else with it but define things.
Is JSON just XML?
No, JSON is not XML. Unlike XML, you can define numbers, booleans, and null values on JSON.
Our latest tutorials delivered straight to your inbox