JSON
JavaScript Object Notation, commonly known as JSON, is a widely used format for storing and transferring data. It is often referred to simply as JSON rather than by its full name.
What is JSON?
JSON is a text-based data transfer format. Developed from JavaScript, JSON is independent of any specific programming language, allowing it to be used for data exchange in applications developed with virtually all modern programming languages. With its human-readable syntax, JSON is one of the preferred formats for developers when it comes to data transfer. This data transfer generally occurs between two different software applications, typically between the server and client, and is often facilitated through APIs in the JSON format. JSON is frequently used in web pages with frequently updated content and in mobile applications.
When data needs to be transferred between two different software applications, JSON is one of the top choices. These applications do not need to be developed in the same programming language; the source application can output data in JSON format, and the target application can import it. Since many programming languages can handle JSON files, this solution is quite practical and can be implemented quickly.
Beyond software-to-software communication, JSON can also be used for data transfer between various hardware components, from industrial machines to IoT devices.
JSON Syntax and Data Types
JSON has a syntax that is simple and easily understandable by humans. Data is stored in name-value (key-value) pairs. Data is separated by commas, and curly braces {} enclose objects. Square brackets [] are used for arrays.
JSON supports several data types, including string, number, object, array, boolean, and null. These data types are used as follows:
String: Strings are enclosed in double quotes. The name-value pair is written within curly braces.
{""name"": ""Ali""}
Number: Numbers in JSON must be integers or floating-point values.
{""age"": 20}
{""weight"": 80.2}
Object: Objects are created by grouping name-value pairs. Different data types can coexist within the same object.
{""student"": {""name"": ""Ali"", ""age"": 20, ""weight"": 80.2}}
Array: Arrays consist of a list of values.
{""students"": [""Ali"", ""Ayşe"", ""Veli""]}
Boolean: Boolean values represent true or false conditions.
{""passed_class"": true}
Null: Null values indicate that a field has no data. In the student example, if some students have a second name and others do not, the field for those without a second name would be null.
{""second_name"": null}
History of JSON
JSON was developed in 2001 by Douglas Crockford in response to the need for real-time communication between servers and browsers without requiring plugins like Flash and Java. In the mid-2000s, the widespread use of Web 2.0 applications and AJAX working with XML led to JSON becoming a serious alternative to XML. ECMA published the first version of JSON standards in 2013.
Our free courses are waiting for you.
You can discover the courses that suits you, prepared by expert instructor in their fields, and start the courses right away. Start exploring our courses without any time constraints or fees.