Skip to content

Commit b131401

Browse files
committed
Added json
1 parent cac350b commit b131401

File tree

2 files changed

+65
-15
lines changed

2 files changed

+65
-15
lines changed

README.md

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -96,26 +96,22 @@ This repository contains Vanilla JavaScript topics and their notes to learn from
9696
- [Creating regular expressions](./docs/regular-expressions.md#-creating-regular-expressions)
9797
- [Common regular expression patterns](./docs/regular-expressions.md#-common-regular-expression-patterns)
9898
- [Matching patterns in strings](./docs/regular-expressions.md#-matching-patterns-in-strings)
99-
3. JSON (JavaScript Object Notation):
100-
- Parsing and manipulating JSON data
101-
4. JavaScript Engine:
102-
- How JavaScript code is executed
103-
- The call stack and event loop
104-
5. Performance Optimization:
105-
- Minimizing DOM manipulations
106-
- Using requestAnimationFrame
107-
- Avoiding unnecessary calculations
108-
- Techniques for improving JavaScript performance
109-
- Code minification
110-
- Tree shaking
111-
- Lazy loading
112-
6. Web APIs:
99+
3. [JSON (JavaScript Object Notation):](./docs/json.md)
100+
- [Parsing and Manipulating](./docs/json.md#-parsing-and-manipulating)
101+
102+
4. Web APIs:
113103
- Fetch API
114104
- WebSockets
115-
- Local Storage and Session Storage
105+
- Local Storage
106+
- Session Storage
116107
- Geolocation API
117108
- Canvas API
118109
- Web Audio API
110+
- Clip board API
111+
- Web camera API
112+
- Microphone API
113+
- Handling Cookies
114+
- Other APIs
119115

120116
By following this roadmap and consistently practicing, you can develop a strong foundation in Vanilla JavaScript and build impressive web applications.
121117

docs/json.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
## ⚑ JSON:
2+
JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for developer to read and write, and easy for machines to parse and generate. It is often used to transmit data between a server and a client web application, or between different parts of a web application.
3+
4+
### ☴ Overview:
5+
1. [Parsing and Manipulating](#-parsing-and-manipulating)
6+
7+
### ✦ Parsing and Manipulating:
8+
JSON syntax is based on JavaScript object literals. It consists of key-value pairs. which is enclose with curly braces {} for objects, and square brackets [] for arrays.
9+
10+
*Syntax:*
11+
```json
12+
{
13+
"name": "Kumar",
14+
"age": 30,
15+
"city": "Chennai"
16+
}
17+
```
18+
19+
**Methods Involved and Used on JSON:**
20+
It has built-in methods, which is provided in JavaScript to work with JSON:
21+
- `JSON.parse()`: Parses a JSON string into a JavaScript object.
22+
- `JSON.stringify()`: Converts a JavaScript object into a JSON string.
23+
24+
**Parsing:**
25+
```javascript
26+
let jsonString = '{"name": "Kumar", "age": 30}';
27+
let jsonObject = JSON.parse(jsonString);
28+
console.log(jsonObject.name); // Output: Kumar
29+
```
30+
31+
**Manipulating:**
32+
```javascript
33+
jsonObject.age = 31;
34+
jsonObject.city = "Chennai";
35+
```
36+
37+
**Convert back into JSON:**
38+
```javascript
39+
let newJsonString = JSON.stringify(jsonObject);
40+
console.log(newJsonString);
41+
```
42+
43+
**Usages of JSON:**
44+
- *Data exchange:* It is commonly used to transmit data between a server and client.
45+
- *Data storage:* It can be used to store data locally in the browser using localStorage or sessionStorage.
46+
- *Configuration files:* It is often used for configuration files due to its human-readable format and easy for machine to parsing.
47+
- *API responses:* Most of APIs return data in JSON format.
48+
49+
---
50+
[⇪ To Top](#-json)
51+
52+
[❮ Previous Topic](./regular-expressions.md)   [Next Topic ❯](./web-apis.md)
53+
54+
[⌂ Goto Home Page](../README.md)

0 commit comments

Comments
 (0)