JSON Flashcards
What does JSON stand for?
JAVASCRIPT OBJECT NOTATION
What is the purpose of JSON?
To allow data to be sent back and forth as simple text that most programming languages can read
Give an example of what JSON looks like
{
“breed: “Coton de Tulear”,
“name”: “Isabella”,
“color”: “white”
}
//notice that there is no comma after the last value pair
Give an example of a JSON object as an array
{
“myCars”: {
“make”: “BMW”,
“model”: “128I”
},
{
“make”: “Honda”,
“model”: “Ridgeline”
}
}
Because it is so similar to JS format, JSON can be used directly in JS
Incorrect. JSON must be parsed to be used in JS. To do this we use method JSON.parse()
What are the two main methods used with JSON data
To parse into a JS object use JSON.parse()
To turn a JS object into JSON use JSON.stringfy(jsObject)