javascript-and-json Flashcards

1
Q

What is JSON?

A

JSON stands for JavaScript Object Notation and it is a file type .json which holds object literals, array literals, numbers, and strings which can be stringified or parsed in JavaScript.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are serialization and deserialization?

A

Serialization is the process of turning an object into bytes so that it can be easily transferred. Deserialization is taking those bytes and converting them to a native object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Why are serialization and deserialization useful?

A

Serialization and deserialization allow easy transportation of data between different files, systems, and coding languages. Strings are a part of all coding languages but JS objects and arrays are much more specific and are storages in memory. Strings are easily converted.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How do you serialize a data structure into a JSON string using JavaScript?

A

To serialize a data structure in JavaScript into a JSON string, use JSON.stringify(JavaScript native object) which will turn the native object into a JSON string.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How do you deserialize a JSON string into a data structure using JavaScript?

A

To deserialize a JSON string into a data structure using JavaScript you use the command JSON.parse(json string) which turns the JSON string into a native JavaScript object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly