Interesting facts about JSON

JSON stands for JavaScript Object Notation, basically, JSON is frequently used with JavaScript, it was initially meant to be a subset of the JavaScript programming language. However, JSON is a language-independent data format. In this article, we are going to learn about JSON and also their interesting facts with examples.

Introduction to JSON

When data can be transported and stored in a simple format is called JSON, or JavaScript Object Notation. Arrays, objects, names and value pairs, and other data types can all be found in JSON. The format uses quotation marks, brackets, parentheses, semicolons, and colons as punctuation. In JSON, data are expressed as name-value pairs, much like JavaScript object attributes. JSON is a lightweight way of data transport. And also, this language is described as being prototype-based, multi-paradigmatic, and dynamic. We need to use JSON whenever data is sent from a server to a web page.

Facts of JSON

Here we are going to discuss so many interesting facts about JSON with explanations and examples. Following are the interesting facts about JSON −

  • Initially, JSON was considered a subset of the JavaScript programming language. (especially the December 1999 release of Standard ECMA-262, Third Edition).
  • JSON was generated from JavaScript, numerous programming languages now have code that may be used to call and interpret JSON-format data. It is a data format that is not language specific. The accepted Internet media type for JSON is application/JSON. The .json extension is used for JSON filenames.
  • Douglas Crockford was the first to define and popularise the JSON format. In April 2001, Douglas Crockford and Chip Morningstar sent the first JSON message.
  • Crockford inserted a phrase to the JSON license declaring that “The Software Shall Be Used for Good, Not Evil.” On the other side, because free software and open-source software often imply no limits on the purpose of usage, this section caused licensing compatibility issues of the JSON license with other open-source licenses.
  • The syntax of the JSON format is comparable to that of the JavaScript object creation code. This makes it simple for a JavaScript program to turn JSON data into JavaScript objects. JSON data may be utilized by any programming language and is easily transferrable between machines because it is merely in text format.
  • There is a trading game of children’s digital assets called Cartoon Orbit at Communities.com (the State co-founders had all previously worked at this company) for Cartoon Network used a plug-in of browser-side with a custom messaging system to change DHTML components. This was the beginning phase of the JSON libraries.
  • The request will typically fail silently if the JSON file has a syntax problem. JSON data shouldn’t be frequently edited by hand for this reason. The data exchange format JSON has higher grammar requirements than JavaScript’s object literal notation. For instance, all strings in JSON representations, whether they are values or properties, need to be contained in double quotes
  • The JSON string is decrypted by JavaScript running in the user’s browser, which then displays the product data on the page.

Working with JSON

As we have seen that JSON is a type of object in the JavaScript programming language that stores the data in form of a string literal and ends with the .json extension. The object of JSON stores the data in a key-value format that is covered in curly braces just like the objects of JavaScript. Let’s see an example to get a better idea of JSON code −

{
   "key1" : "pair1",
   "key2" : "pair2",
   "key3" : {
      "sub-key1" : "opp_value",
      "sub_key2" : "opp_value",
   },
   "key4" : {
      "sub-key1" : "opp_value",
      "sub_key2" : "opp_value",
   },
   "key5" : "pair5",
}

In the above code of JSON, we can see that there are five key pairs, in which keys are in the form of simple strings and pairs can be strings or other objects that could be anything like an array, string, etc. All the key pairs are separated by the comma and covered under the curly braces.