After making a fetch request to an api, the response is an array of JSONs, like so:
[ {"key":"val", "k2":"v2"}, {"k3":"v3", "k4":"v4"} ]
So far I am trying to handle this by doing response => response.text()
Is there any efficient method to parse this array into separate JSONs, other than tediously parsing it as one big string?
Use the body.json() function
response.json().then(function(data) {
// do something with your data
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.