JSON Parse and Stringify

JSON.parse() takes a JSON string and transforms it into a JavaScript object.

Here's an example or parsing:

JSON.stringify() takes a JavaScript object and transforms it into a JSON string.

Here's an example of stringify:

We can use the reviver function on parse to tranform the data, like this:

We can also use the replacer function to prevent an item from being used, like this:

Finally, we can use the spacer function to add spaces.