Hello,
I have a website that puts all its API data into a script tag. For example:
<!DOCTYPE html>
<html>
<head>
<script type="application/ld+json">
{"UserDetails":{"name":"ben","lastname":"mitchell"},"Media":{"image":"https://example.com","video":"https://example.com"}}
</script>
</head>
</html>
I have been able to fetch the website successfully. My question now is, how do I take the response and parse it so that I can read that JSON data.
Essentially I want to be able to do something like
- Fetch the website
- Parse the HTML
- Parse the JSON from that HTML
- name = UserDetails.name
- image = Media.image
something like that.
Any ideas?