JavaScript Asynchronous Programming with JavaScript Understanding Promises Using Fetch

Kirt Perez
Kirt Perez
6,513 Points

Is .json() the same as JSON.parse()?


1 Answer

Jennifer Nordell
Jennifer Nordell
Treehouse Teacher

Hi there, Kirt Perez! They are very similar, but not exactly the same. Yes, they both create JSON. However, the .json() is asynchronous and returns a Promise. While the JSON.parse is synchronous. The .json() takes the Response and turns it into JSON while the JSON.parse() takes a JSON formatted string and returns any one of a few data types.

For more information, I recommend the following:

Hope this helps! :sparkles: