Json
Json
1. Overview
2. Exchange Data
2
1. Overview
3
1. Overview
A JSON string can be stored in its own file, which is basically just a text file
with an extension of .json, and a MIME type of application/json.
JSON Structure
• You can include the same basic data types inside JSON as you can in a
standard JavaScript object — strings, numbers, arrays, booleans, and
other object literals. This allows you to construct a data hierarchy, like so:
5
1. Overview
Syntax {
"fullname": "Reksmey",
{ "age": 25,
"key" : value "major": "IT",
} "position": "Manager",
"specialized": [
"Web Design",
"iOS App Development",
"React Native",
"Spring Framework",
"DevOps",
"Managment & Leadership",
"Project Mentor"
],
"remark": "R & D Department",
"status": true
}
6
1. Overview
Other notes
• JSON is purely a string with a specified data format — it contains only
properties, no methods.
• JSON requires double quotes to be used around strings and property names.
Single quotes are not valid other than surrounding the entire JSON string.
• Even a single misplaced comma or colon can cause a JSON file to go wrong,
and not work.
• JSON can actually take the form of any data type that is valid for inclusion
inside JSON, not just arrays or objects. So for example, a single string or
number would be valid JSON.
• Unlike in JavaScript code in which object properties may be unquoted, in
JSON only quoted strings may be used as properties.
7
2. Exchange Data
8
2. Exchange Data
• We retrieve the response as text rather than JSON, by calling the text() not
json() method of the response.
9
Thank you
Perfect Practice, Does Perfect Thing
10