JSON - Runtime Terror

From Coder Merlin
Within these castle walls be forged Mavens of Computer Science ...
— Merlin, The Coder

What is JSON? JSON is a subset of JavaScript, and it’s an abbreviation for JavaScript Object Notation. Although it’s for JavaScript, it is also supported natively or through libraries in many other programming languages. JSON can both store and transport data. JSON is easy to understand because of how self describing it is. It is a human-readable format for structuring data. JSON is mainly made up of 2 parts. A key and a value. Together, they're called a key/value pair. A key/value pair is the key first then followed by a colon. The value comes after the colon. JSON can also be used to exchange information between web clients and web servers.

JSON Usage JSON is used in web services to send and receive http requests and responses between clients and servers. Its lightweightedness and small size makes it perfectly suited for managing data. As a result, it can be used to manage small amounts of data related to user information to simplify large and complex data models. JSON has become the standard format for managing data, replacing XML. Using Asynchronous Javascript and JSON (AJAJ) web development techniques, data can be quickly sent and requested as a user interfaces a webpage containing text information. AJAJ allows webpages to update and load new information without having to refresh web pages. JSON is used to display structured data on a webpage, but it is also complemented with HTML and CSS to style and markup.

Common uses of JSON JSON is a very popular transport protocol and thus can be used to facilitate almost any process which requires data transfer. There are also several similar protocols like GeoJSON and Smile which have been built upon the foundation of JSON to facilitate different transport, such as transferring geographical features. Because JSON is based upon JavaScript, which is supported on web browsers, JSON is heavily used on web applications to send data between a client and server. For example, on a simple login web page, after the user clicks the login button, the frontend JavaScript service may hash (encrypt) the password typed and encode the username and the hash created into JSON data, which would then be sent to the server through a method such as a secure POST request. Not only on many websites, JSON is also used in mobile applications which need to transport data one-way or even back and forth. It’s popularity arises due to good human readability (it doesn’t have to be read in 0s and 1s!) and easy-to-learn structure.

Pros and cons of JSON This popular data structure has quite a few benefits. JSON uses a map structure. In some situations, key/value pairs can limit what you can do, but you get a predictable and easy-to-understand data model. JSON is extremely lightweight to send back and forth in HTTP requests and responses due to the small file size. It is also easy to read, and there’s not as many opening and closing tags to worry about. And last but not least, almost every single major language has some form of library or built-in functionality to parse JSON strings into objects or classes in that language. These advantages come with some cons as well. For example, JSON does not directly support the extension of base types. Furthermore, there is no ability to add comments or attribute tags to JSON, which limits your ability to annotate your data structures or add useful metadata. And lastly, JSON is not well-suited to combining information sets from different systems.