removed html tags, removed weird color at line 70 and 117

pull/477/head
Yatharth 2024-05-18 18:56:11 +05:30
rodzic 72909dc3ab
commit 7375e91a25
1 zmienionych plików z 7 dodań i 11 usunięć

Wyświetl plik

@ -2,7 +2,7 @@
## What is JSON? ## What is JSON?
- <a href="https://www.json.org/json-en.html">JSON (JavaScript Object Notation)</a> is a format for structuring data. - [JSON]("https://www.json.org/json-en.html") (JavaScript Object Notation) is a format for structuring data.
- JSON is a lightweight, text-based data interchange format that is completely language-independent. - JSON is a lightweight, text-based data interchange format that is completely language-independent.
- Similar to XML, JSON is a format for structuring data commonly used by web applications to communicate with each other. - Similar to XML, JSON is a format for structuring data commonly used by web applications to communicate with each other.
@ -14,7 +14,7 @@
age = 21 age = 21
``` ```
- When we use `age`, it gets replaced with `21`. However, <i>age doesn't contain 21, it contains the address of the memory location where 21 is stored</i>. - When we use `age`, it gets replaced with `21`. However, *age doesn't contain 21, it contains the address of the memory location where 21 is stored*.
- While this works locally, transferring this data, such as through an API, poses a challenge. Sending your computers entire memory with the addresses is impractical and insecure. This is where JSON comes to the rescue. - While this works locally, transferring this data, such as through an API, poses a challenge. Sending your computers entire memory with the addresses is impractical and insecure. This is where JSON comes to the rescue.
@ -67,7 +67,7 @@ print(students_dict['name'])
- Ouput: - Ouput:
```json ```json
{'id': '01', 'name': 'Yatharth', 'department': 'Computer Science Engineering'} {"id": "01", "name": "Yatharth", "department": "Computer Science Engineering"}
Yatharth Yatharth
``` ```
@ -114,16 +114,15 @@ f.close()
- Ouput - Ouput
```json ```json
{'id': '01', 'name': 'Yatharth', 'department': 'Computer Science Engineering'} {"id": "01", "name": "Yatharth", "department": "Computer Science Engineering"}
{'id': '02', 'name': 'Raj', 'department': 'Mechanical Engineering'} {"id": "02", "name": "Raj", "department": "Mechanical Engineering"}
``` ```
- `json.load()`: Reads JSON data from a file object and deserializes it into a Python object. - `json.load()`: Reads JSON data from a file object and deserializes it into a Python object.
- `json.loads()`: Deserializes JSON data from a string into a Python object. - `json.loads()`: Deserializes JSON data from a string into a Python object.
<hr>
### Addtiotnal Context
## Addtiotnal Context
Relation between python data types and json data types is given in table below. Relation between python data types and json data types is given in table below.
</br>
| Python Object | JSON Object | | Python Object | JSON Object |
|-----------------|-------------| |-----------------|-------------|
@ -288,7 +287,4 @@ write_json(y)
} }
``` ```
</br>
<hr>
The Python json module simplifies the handling of JSON data, offering a bridge between Python data structures and JSON representations, vital for data exchange and storage in modern applications. The Python json module simplifies the handling of JSON data, offering a bridge between Python data structures and JSON representations, vital for data exchange and storage in modern applications.