What is a JSON file?

JSON (JavaScript Object Notation) is an open standard file format for sharing data that uses human-readable text to store and transmit data.

What is a JSON file?

JSON (JavaScript Object Notation) is an open standard file format for sharing data that uses human-readable text to store and transmit data. JSON files are stored with the .json extension. JSON requires less formatting and is a good alternative to XML. JSON is native to JavaScript but is a language-independent data format. JSON generation and parsing is supported by many modern programming languages. application/json is the media type used for JSON.

What is a JSON file? Picture 1What is a JSON file? Picture 1

Brief history of the JSON file format

The need to communicate between server and client in real time led to the creation of JSON. The JSON format was first specified by Douglas Crockford in March 2001. JSON is based on the ECMA-262 standard 3rd Edition - December 1999, which is a subset of JavaScript.

The first version of the JSON ECMA-404 standard was published in October 2013 by Ecma International. RFC 7159 became the primary reference for the Internet use of JSON in 2014. In November 2017, ISO/IEC 21778:2017 was published as an international standard. RFC 8259 was published by The Internet Engineering Task Force on December 13, 2017, which is the current version of the Internet standard STD 90.

JSON file structure

JSON data is written in key/value pairs. The key and value are separated by a colon (:) in the middle with the key on the left and the value on the right. Different key/value pairs are separated by a comma (,). Key is a string surrounded by quotes, e.g. 'name'. Values ​​can be of the following types.

  1. Numbers
  2. String: String of Unicode characters surrounded by quotes.
  3. Boolean: True or False.
  4. Array: Example of a list of values ​​surrounded by square brackets
[ "Apple", "Banana", "Orange" ]
  1. Object: For example, a collection of key/value pairs surrounded by curly braces
{"name": "Jack", "age": 30, "favoriteSport" : "Football"}

JSON objects can also be nested to represent the structure of the data. Below is an example of a JSON object.

JSON format example

{ "name":"Jack", "age":30, "contactNumbers":[ { "type":"Home", "number":"123 123-123" }, { "type":"Office", "number":"321 321-321" } ], "spouse":null, "favoriteSports":[ "Football", "Cricket" ] }

What is the maximum size of a JSON file?

There is actually no limit to the maximum size of a JSON file. It can be as long as the space required by the content being stored.

When it comes to using the JSON file format to transmit data over the Internet, one needs to be careful about the available resources of the computer. If large JSON data is transferred, the transfer will be affected if the client browser has limited memory.

There is no fixed limit defined by the specification, but you need to be careful not to exhaust the resources on the user's computer, as it will quickly degrade the user experience and they may will abandon your application.

What makes JSON superior to XML?

XML is another popular and widely used file format for exchanging data over the Internet. When it comes to exchanging data between applications, developers have the option of using both XML and JSON file formats. However, JSON is considered the most convenient way to exchange data between applications over the Internet for the following reasons.

  1. JSON provides a clearer and easier to read view of data than XML file formats
  2. JSON reduces the cost of transmitting data over the Internet because it has fewer characters to identify the same set of data compared to XML
  3. Modern programming languages ​​provide built-in parsers to parse JSON responses on the web.
4.5 ★ | 2 Vote