JSON.parse() Vs. .json()

Body.json() is asynchronous and returns a Promise object that resolves to a JavaScript object. JSON.parse() is synchronous can parse a string and change the resulting returned JavaScript object.


'AJAX' works with 'callbacks'; 'fetch' works with 'promises'.

Use JSON.parse() to parse the response for AJAX. Use json() to parse the response for fetch.


In my view both res.json and JSON.parse do the same functioning. Preference to res.json is given because of it's syntax. Sharing the example for better understanding...

 this.service.userFunction() //calling service
.then((res) => {
 this.userdetails = JSON.parse(res._body); //use this
 this.userdetails = res.json(); // or use this syntax any one
 )}
.catch()

Using any of one them will provide the the complete response body and understanding of their functionality.