Skip to content

Commit d0a5ca9

Browse files
authored
chapter 1 - subchapter 1.6. - 1.7 uploaded
chapter 1 - subchapter 1.6. - 1.7 uploaded
1 parent 073a849 commit d0a5ca9

File tree

1 file changed

+97
-4
lines changed

1 file changed

+97
-4
lines changed

readme.md

Lines changed: 97 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ This course/Tutorial is for anyone and everyone, Almost everyone!
3636

3737
Why learn JSON
3838
---------------------
39-
JSON stands for JavaScript Object Notation is text-based and human-readable. JSON has become a widely accepted and popular format for data due to its platform-neutral nature, lightweight format, and it’s the ability to convert directly to native JavaScript Objects. JSON is being used everywhere from Web APIs to noSQL databases, to server-side language libraries and client-side frameworks.
39+
JSON stands for JavaScript Object Notation is text-based and human-readable. JSON has become a widely accepted and popular format for data due to its platform-neutral nature, lightweight format, and it’s the ability to convert directly to native JavaScript Objects. JSON is being used everywhere from Web APIs to NoSQL databases, to server-side language libraries and client-side frameworks.
4040

4141
JSON has significantly improved server-to-browser communications, especially when it comes to AJAX. JSON is better than XML and more popular! Easily exchange data between client and server applications. JSON is easy to use and built for storing and exchanging data.
4242

@@ -74,9 +74,12 @@ Topics included/covered
7474
- 1.3. [What JSON is not?](#13-what-json-is-not)
7575
- 1.4. [Usage of JSON](#14-usage-of-json)
7676
- 1.5. [Characterstics of JSON](#15-characterstics-of-json)
77+
- 1.6. [JSON Syntax](#16-json-syntax)
78+
- 1.7. [JSON vs XML](#17-json-vs-xml)
7779

80+
<!--
7881
2. [JSON Resources](#2-json-resources)
79-
82+
-->
8083

8184
1 Introduction to JSON
8285
=====================
@@ -114,7 +117,7 @@ JSON uses, follows and based on Object Literal Notation syntax of JavaScript. JS
114117
- JSON is easy to use and built for storing and exchanging data
115118
- Since the JSON format is text only, it can easily be sent to and from a server and used as a data format by any programming language
116119

117-
JSON has become a widely accepted and popular format for data due to its platform-neutral nature, lightweight format, and it’s the ability to convert directly to native JavaScript Objects. JSON is being used everywhere from Web APIs to noSQL databases, to server-side language libraries and client-side frameworks.
120+
JSON has become a widely accepted and popular format for data due to its platform-neutral nature, lightweight format, and it’s the ability to convert directly to native JavaScript Objects. JSON is being used everywhere from Web APIs to NoSQL databases, to server-side language libraries and client-side frameworks.
118121

119122
JSON has significantly improved server-to-browser communications, especially when it comes to AJAX. JSON is better than XML and more popular! Easily exchange data between client and server applications. JSON is easy to use and built for storing and exchanging data.
120123

@@ -139,6 +142,7 @@ JSON is programming language independent Data Interchange Format - an only text-
139142
- It is primarily used to transmit data between a server and web applications (client and server)
140143
- Web services and APIs use JSON format to provide public data
141144
- It can be used with different platform-independent modern programming languages
145+
- JSON is used in Web APIs as well as NoSQL databases
142146

143147
1.5. Characteristics of JSON
144148
---------------------
@@ -148,5 +152,94 @@ JSON is programming language independent Data Interchange Format - an only text-
148152
- JSON is language independent
149153
- JSON uses, follows and based on Object Literal Notation syntax of JavaScript
150154
- JSON is widely used to exchange, send and receive data from server to client and vice versa
151-
- JSON represent data in the pair of Curley braces and in the form of key-value pairs ie property and data e.g. ` var Employee = { "employeeName": "Dinanath", "employeeId": "101"} `
155+
- JSON represent data in the pair of Curley braces and in the form of key-value pairs ie property and data e.g. ` var Employee = { "employeeName": "Dinanath", "employeeId": "101", "empId": 101} `
152156
- Transfer data easily between Server and Client
157+
158+
1.6. JSON Syntax
159+
---------------------
160+
161+
- JSON syntax is very simple and uses `name : value pair` or `key : value pair`
162+
163+
The JSON syntax is a subset of the JavaScript syntax. JSON syntax is derived from JavaScript object notation syntax:
164+
- Data is in name/value pairs
165+
- Data is separated by commas
166+
- Curly braces hold objects
167+
- Square brackets hold arrays
168+
169+
JSON format starts with `curley brace/bracket {` and `ends with curley brace/bracket }`. In-between curley brace we can put `"name" and value` or `"key":value` or `"property":value/data` pair, every property of the object is seperated by comma.
170+
171+
JSON represents data in the `pair of curly braces and in the form of key-value pairs ie property and data`. We can separate `Property Name` with the help of `colon:` then specify `property Value` and multiple properties are separated with `comma,`.
172+
173+
```
174+
175+
- JSON, keys must be strings, written with "double quotes", JavaScript names don't.
176+
177+
```
178+
179+
To access or read data from a JSON object, we simply need to use property name with `. dot notation`, will get all IntelliSense as soon as will use any jsonObjectName.propertyName i.e. JsonObjectName.propertyName or so.
180+
181+
As soon as we assign JSON format/values to any JavaScript variable, it becomes a JavaScript object to which we can access via `. dot notation`.
182+
183+
### 1.6.1. JSON Values
184+
In JSON, values must be one of the following data types:
185+
186+
- a string
187+
- a number
188+
- an object (JSON object)
189+
- an array
190+
- a boolean
191+
- null
192+
193+
> **Syntax & Example**: `1.6.1-employee.json`
194+
195+
```
196+
{
197+
"employeeName": "Dinanath",
198+
"employeeId": 100,
199+
"department": "IT-Development",
200+
"role": "Sr. UI Developer",
201+
"salary": 100000
202+
}
203+
```
204+
205+
<hr/>
206+
207+
> **Syntax & Example**: `1.6.2-technology.json`
208+
209+
```
210+
{
211+
"technologyName": "JSON (JavaScript Object Notation)",
212+
"inventor": "Douglas Crockford",
213+
"usage": "Data storage and exchange format",
214+
"version": 1.0,
215+
"cost": 0,
216+
"license": "Open Source - MIT"
217+
}
218+
```
219+
220+
> **Syntax & Example**: `1.6.3-person.json`
221+
222+
```
223+
{
224+
"name": "Dinanath",
225+
"age": 50,
226+
"country": "India",
227+
"height": 5.6,
228+
"color": "Black-Medium",
229+
"married": true
230+
}
231+
```
232+
233+
234+
1.7. JSON vs XML
235+
---------------------
236+
237+
### 1.7.1. Difference between JSON and XML
238+
239+
| JSON | XML |
240+
| --------------------------------|---------------------------------------|
241+
| JavaScript Object Notation | eXtensible Markup Language |
242+
| JSON uses `key : value` or `name : value` pair to store data (JSON doesn't use end tag) | XML uses tags **&lt; value &gt;** to store data |
243+
| JSON is shorter | XML is pretty larger/lengthy as we need to open and close tags for every `name` or `key`|
244+
| JSON is quicker and easier to read and write | XML is little difficult to read and write as we need to write many tags |
245+
| JSON can use arrays | XML cant use arrays, it uses tags|

0 commit comments

Comments
 (0)