Objectives

JSON

1. Identify and generate valid JSON-formatted strings

2. Use JSON.parse to deserialize JSON-formatted strings

const JSONString = '[1, 2, 3, 4, "apple", "banana, "pear"]';
const myList = JSON.parse(JSONString);
console.log(myList[4]); // "apple"

3. Use JSON.stringify to serialize JavaScript objects

const fruits = ["apple", "banana", "pear"];
const JSONString = JSON.stringify(fruits);
console.log(JSONString); // ["apple", "banana", "pear"]

4. Correctly identify the definition of “deserialize”

5. Correctly identify the definition of “serialize”


Storage

1. Write JavaScript to store the value “I <3 falafel” with the key “eatz” in the browser’s local storage.

localStorage.setItem("eatz", "I <3 falafel");

2. Write JavaScript to read the value stored in local storage for the key “paper-trail”.

localStorage.getItem("paper-trail");