To start with I'm not 5 years old. I'm just getting started with Javascript, and I don't t seem to get what Json is. I will appreciate anyone that can explain json to me in the simplest term...examples will be appreciated too.
Asked
Active
Viewed 694 times
-4
-
It's just a format to communite or transfer data. It contains data in key value pairs. – Mohit Bhardwaj Oct 16 '17 at 07:00
-
It's a file format that contains data in a certain structure. It's very much alike XML in terms of usage. – h2ooooooo Oct 16 '17 at 07:01
-
1This is really an odd question. Have you tried google-ing it? The first result that comes up sums it up quite nicely! – mrCarnivore Oct 16 '17 at 07:03
-
@h2ooooooo does that mean Json is used for data transfer only and not for performing operations. Sorry if my question is amateurish. I wants things to click – samolusola Oct 16 '17 at 07:17
-
1I think your question is too broad for this site's format. You should consider specifying what concrete problem you have with Json. As in, what is it's purpose, how does the sintax work, how is it related to javascript... If you want your question answered in this specific format, you should check the subreddit "explain me like i'm 5". – Daniel García Rubio Oct 16 '17 at 07:20
-
@Samimath Json is _just_ a text representation of a data structure. It has no logic built in - no functions - no calculations. Just pure "this key is equal to this data, this other key is equal to this other data". Consider it an advanced CSV file if it makes more sense to you. – h2ooooooo Oct 16 '17 at 07:24
-
@h2ooooooo Thank you. it's making more sense now. – samolusola Oct 17 '17 at 06:04
2 Answers
4
json is similar to filling your name slip on a book cover.
In json information is written in a structure, which helps every one understand information easily.
In json your name slip will look like:
{
"name": "Samimath",
"class": 1,
"sec": 1,
"subject": "english",
"rollno": 5,
"school": "Rainbow Public School",
"contact": 555666777
}

Vivek Rawat
- 126
- 1
- 7
2
Json is a serialization format, allowing us to convert objects to strings and vice-versa.
For example you might have a variable called Person
var person = {
Firstname: "Mike",
Surname: "Smith"
};
var json = JSON.stringify(person);
This will look like: {"Firstname":"Mike","Surname":"Smith"}
We can also de-serialize by doing: var person2 = JSON.parse(json);
By converting objects to strings we can exchange data with other systems, e.g. web services, databases, messaging etc. Json then works as a common format between these systems.

Terry Lennox
- 29,471
- 5
- 28
- 40