0

Where I use .JSON and JSON.parse() ??

Tell me where can I use this two thing ??

28th Aug 2021, 11:00 AM
Aniket Ganguly
3 Antworten
+ 3
.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 and fetch api works with promises. so we use JSON.parse() to parse the response for AJAX and use json() to parse the response for fetch.
28th Aug 2021, 12:03 PM
Pariket Thakur
Pariket Thakur - avatar
0
To Convert data -> javascript object
28th Aug 2021, 11:02 AM
Vtec Fan
Vtec Fan - avatar
28th Aug 2021, 11:10 AM
Vtec Fan
Vtec Fan - avatar