The term JSON is common vocabulary for persons who are into Software engineering or Data science.
As a newbie, you may get confused with the appellation JSON however, in this article we will explain the concept of JSON, how to create a JSON file, and how to easily open a JSON file using text editors.
JSON is an acronym that represents JavaScript Object Notation.
As captured in its naming, the word ‘Notation’ indicates that JSON is a way of representing data independent of a platform.
A simpler way of explaining this concept is by utilizing the analogy of a PDF file.
A PDF file is the same irrespective of the platform (desktop, mobile, and web).
Hence, it is safe to say that JSON is a PDF for data.
What is .JSON?
.JSON is an extension used to save JavaScript Object Notation (JSON) files. These files store data and objects in an organized and easy-to-access manner called the JSON format.
The JSON format was initially specified by Douglas Crockford (an American computer programmer) in the early 2000s. In 2013 JSON became an ECMA international standard and the most updated JSON format standard was published in 2017.
.JSON format is simply a lightweight text-based open standard format designed for human-readable data interchange.
Previously JSON files were used solely to transport data between the web application and the server.
However, in recent times, it has found more applications for many purposes such as taking and restoring data backup, etc.
Features of JSON
- Structure – JSON objects have a standard structure and this makes work quite easy for developers
- Performance – Because of its file size, loading JSON files is quicker and faster. This comes in very handy when working with AJAX because data need to be loaded quickly and asynchronously without requesting a page reload
- Light-Weight – JSON files consume very less memory space
- Simplicity– JSON API offers a high-level facade that supports you to simplify commonly used use-case
- Scalable –JSON works well with most modern programming languages. If there is a need to change either the server or client-side language, the impact of such changes will be minimal because JSON structure is the same across all languages.
Uses of JSON
JSON has found usefulness in many areas. For example,
- Modern programming languages like python, use JSON
- It is used to transmit data between a server and web applications
- Web services and Application Programming Interfaces (APIs) use JSON format to provide public data
- It is used for serializing and transmitting structured data over a network connection
- JSON is used when writing Javascript applications that have browser extensions and websites
- Finally, JSON is used for application configuration files (such as games)
Characteristics of JSON
- JSON is completely language-independent.
- JSON is easy to read and write and execute
- It is lightweight and has an intuitive design
- JSON has a straightforward syntax
- It is supported by most backend technologies
- It provides support for all browsers
- It can easily be used for storing and transmitting data objects (consisting of attributes-value pairs and arrays)
How to create JSON files
To create a JSON file, follow the basic steps outlined below:
Step 1: Open the text editor on your computer.
NOTE: The text editor available on your computer may be dependent on the operating system used.
- Windows – Microsoft Notepad
- Mac – Apple TextEdit
- Linux – Vim
Step 2: Create a new file and save it using the ‘.json’ extension
Step 3: Copy the code below and paste it into the file then save it
{
“student”: [
{
“id”:”01″,
“name”: “Nathan”,
“lastname”: “Smith”
},
{
“id”:”02″,
“name”: “Jason”,
“lastname”: “Gerald”
}
]
}
How to Open a JSON file
Generally, because JSON files are plain text-based, they can be opened using any text editor.
In this section, we will see how to open a JSON file using
- Notepad
- Web browser
Opening A JASON file Using NotePad
One of the simplest ways to read a JSON file is by using Notepad. This is a generic text editor included with all versions of Microsoft Windows. Here is how to open a JSON file using Notepad:
Step 1: Right-click on your JSON file, and select the ‘Open with’ option from the menu
Step 2: Select the ‘Choose another app’ button. A window that contains a list of all apps will open. Click on the More apps to show the available programs that can be used.
Step 3: Choose Notepad from the displayed list and select OK.
The JSON file is opened and its content displayed.
Using Web Browser
Web browsers like Mozilla Firefox and Google Chrome can also read JSON files. Here is how to open a JSON file using Web browsers:
OPTION 1:
Step 1: Right-click on your JSON file, and select the ‘Open with’ option from the menu
Step 2: Select the ‘Choose another app’ button. A window that contains a list of all apps will open. Click on the More apps to show the available programs that can be used.
Step 3: Choose either ‘Mozilla Firefox’ or ‘Google Chrome’ from the displayed list and select OK.
The JSON file is opened and its content displayed.
OPTION 2:
Drag and drop the JSON file into your browser.
This opens the JSON file and displays its content.
Other Programs that can Open JSON Files
The table below presents a summary of programs that can open JSON files across various operating systems.
OPERATING SYSTEM | PROGRAM/ EDITOR |
Android | File viewer for Android |
Google Chrome | |
Mozilla Firefox | |
Chrome OS | Google Chrome |
Mozilla Firefox | |
IOS | Google Chrome |
Mozilla Firefox | |
Linux | Vim |
Pico | |
GNU Emacs | |
GitHub Atom | |
Microsoft Visual Studio Code | |
Mozilla Firefox | |
Google Chrome | |
Mac | Apple TextEdit |
MacVim | |
GitHub Atom | |
Microsoft Visual Studio Code | |
Mozilla Firefox | |
Google Chrome | |
Windows | File Viewer Plus |
Altova XMLSpy | |
Microsoft Notepad | |
Microsoft Wordpad | |
Notpad++ | |
GitHub Atom | |
Microsoft Visual Studio Code | |
Mozilla Firefox | |
Google Chrome | |
Conclusion
As highlighted above, one of the major choices of format for the transfer of data between computers that exchange tons of data each day is JSON and this is hinged on its cross-platform independence and its lightweight and easy to read features.
Finally, the choice of text editor is largely dependent on:
-
The operating system of your computer and
-
The program you feel most conversant comfortable with navigating its functionalities