From 12a3904148e31056d8cb7437a44f4098793e0e83 Mon Sep 17 00:00:00 2001 From: CSnap Date: Sun, 19 Nov 2023 08:07:38 +0000 Subject: [PATCH] Modified JSON Sheet. --- JSON.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/JSON.md b/JSON.md index 5b0975a..2286109 100644 --- a/JSON.md +++ b/JSON.md @@ -32,47 +32,47 @@ } ``` -## 1. Introduction to JSON +## Introduction to JSON - JSON stands for **JavaScript Object Notation**. - It is a lightweight data interchange format. - JSON is language-independent and easy for humans to read and write. - Commonly used for data exchange between a server and web application, as well as for configuration files. -## 2. JSON Data Types +## JSON Data Types -### 2.1 String +### String - Represents a sequence of characters. - Enclosed in double quotes. - Example: `"Hello, World!"` -### 2.2 Number +### Number - Represents a numerical value (integer or floating-point). - Example: `42` or `3.14` -### 2.3 Boolean +### Boolean - Represents a logical value, either `true` or `false`. -### 2.4 Array +### Array - Ordered list of values. - Enclosed in square brackets `[]`. - Example: `[1, 2, "three", true]` -### 2.5 Object +### Object - Unordered collection of key-value pairs. - Enclosed in curly braces `{}`. - Example: `{"name": "John", "age": 30, "city": "New York"}` -### 2.6 Null +### Null - Represents a null or empty value. -## 3. JSON Syntax +## JSON Syntax - Data is represented in key-value pairs. - Keys are always strings and followed by a colon. @@ -80,7 +80,7 @@ - Objects are enclosed in curly braces `{}`. - Arrays are enclosed in square brackets `[]`. -## 4. JSON Example +## JSON Example ```json { @@ -114,7 +114,7 @@ with open('output.json', 'w') as json_file: json.dump(data_to_write, json_file, indent=4) ``` -## 6. Accessing JSON Data in JavaScript +## Accessing JSON Data in JavaScript ```javascript // Assuming jsonString is a JSON string @@ -125,7 +125,7 @@ console.log(jsonData.name); // Outputs: John Doe console.log(jsonData.address.city); // Outputs: Anytown ``` -## 7. Accessing JSON Data in PHP +## Accessing JSON Data in PHP ```php // Assuming jsonString is a JSON string