JSON

Java Collections
Level 3 , Lesson 2
Available

"False alarm. Everything is fine with my relief valve."

"Let's continue. Today I want to explain what JSON is."

JSON - 1

"Yeah, I've heard that word many times. What does it mean?"

"With the web's growth, HTML pages with JavaScript began to actively communicate with servers and download data from servers. To make this process easier, a standard was invented for communication between the server and a JavaScript program. This standard is called JSON (JavaScript Object Notation).."

"So what is this standard?"

"Oh, that's the most interesting part. The declaration of a JavaScript object was chosen as the standard!"

"Here's an example of messages in JSON format:"

Messages in JSON format
{
 "name": "peter",
 "last": "jones"
}
{
 "name": "batman",
 "enemies": [1,4,6,7,8,4,3,90]
}
{
 "name": "grandpa",
 "children": [
{
 "name" = "Bob",
 "children": ["Emma", "Nikol"]
},
{
 "name" = "Devid",
 "children": ["Jesica", "Pamela"]
}
]
}
{
 "12 45": {
 "__++": [],
 "1":"2"
 }
}
{}

"So, these messages are simply passing data that actually just represents JavaScript objects?"

"Yep. And this is super convenient for two reasons:"

"First, there's no need to convert data from the 'delivery format' into a collection of JavaScript objects."

"Secondly, this format is very visual: it is easily read and edited by humans."

"Of course, there are some limitations: not everything can be represented as a collection of objects, arrays, text, and numbers."

"For example, a Date object is sent as a String: «2012-04-23T18:25:43.511Z»"

"Even still, this method of sending information is extremely convenient, readable, rather lightweight, and contains a minimal amount of extra information. This helped it become very popular."

"In my opinion, JSON is a very simple format. Everything about it is obvious and clear."

"And JavaScript itself isn't very complicated."

"The language is simple, but programs written in it are complicated."

"Or, as my uncle used to say, human English has 26 letters, but learning to speak it properly is no easy task for a lobster."

"Hmm. You're right, Bilaabo. I'll keep that in mind. Thanks for the interesting lesson."

Comments (1)
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION
Hoist Level 35, San Diego, United States
11 January 2024
super convenient for two reasons:" "First, there's no need to convert data from the 'delivery format' into a collection of JavaScript objects." "Secondly, this format is very visual: it is easily read and edited by humans."