How do I use JSON.parse to parse the response of the section rendering API?

I’m using the guide here: https://shopify.dev/api/section-rendering

I can get the response, console it, and see the field I want to get (‘responseText’). But when I used JSON.parse(response.responseText) I get an error in the console: ‘Uncaught SyntaxError: Unexpected end of JSON input’.

Any ideas why this might be?

Thanks!

Got it. Ended up having to use the onload, readyState, and status method because the data wasn’t received yet, per the MDN article on it. Shopify docs mentioned nothing about it. https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/responseText