JSON is a JavaScript-derived file format that stores data in an organized and human-readable way. In this article, we will try to tell you everything you need to know about it.
JSON stands for JavaScript Object Notation. It is an open-standard file format for storing data in an organized and human-readable manner while facilitating access. The data is presented in a textual format consisting of “key/value” pairs.
Closely related to JavaScript, this format can, however, be generated and read by most programming languages. This universality has allowed it to become a very popular way to store, organize, read and share data in web applications and services.
Many websites use JSON for sharing data in addition to RSS feeds. For good reason, JSON streams can be loaded asynchronously more easily than XML/RSS feeds. It is therefore used a lot for asynchronous communication between browser and server, especially as replacement of XML in some AJAX type systems.
The JSON story
JavaScript Object Notation was originally born from an association between JavaScript and client-side scripting. It was invented by Douglas Crockford, who continues to maintain the official website JSON.org.
The first official JSON specification is the 2013 ECMA-404 standard, but the official website was launched in 2002. In addition, Yahoo and Google started using it as early as 2005/2006.
How to store JSON objects?
Specifically, JavaScript Object Notation objects are just text. It is, therefore, possible to store them in many ways. They can be stored in a database, in a separate text file, in client storage such as cookies or localStorage, or even using the .json format.
Once the content is stored, it can be retrieved and decrypted in different ways and in different languages. With JavaScript, you can use the JSON.stringify () and JSON.parse () methods.
JSON vs XML: what is the best data format?
Although XML is still widely used, JSON has gained a lot of popularity. According to its creator, this format has several advantages over XML.
In particular, XML is not optimized for data exchange. For good reason, it does not correspond to the data model of most languages.
What are the disadvantages of JSON?
Despite its many advantages, such as its flexibility and conciseness, this data format has several weak points. First, the lack of a schema that allows flexibility in terms of data representation also increases the risk of “distorting” the data.
In addition, the only type of compatible number is the IEEE-754 double-precision floating-point format. It is therefore not possible to take advantage of the more varied and nuanced types of numbers found in many programming languages.
There is no type of date either. In fact, developers must represent dates as strings. This can lead to format discrepancies. The only alternative is to represent the dates as milliseconds since January 1, 1970.
The absence of comments also prevents annotating fields. Additional documentation is needed, which increases the risk of misunderstanding. Finally, even if its verbosity is lower compared to XML, this format of data exchange is not the most concise.
If you want more details about JSON and how JSON can impact your business in a good way, give us a call and we’ll set up a meeting.