data block 1) are a way to embed data in a html document.
The well known is ld-json data block
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Organization",
"url": "http://www.example.com",
"name": "Unlimited Ball Bearings Corp.",
"contactPoint": {
"@type": "ContactPoint",
"telephone": "+1-401-555-1212",
"contactType": "Customer service"
}
}
</script>
Inject json data in pre-rendered HTML
document.addEventListener("DOMContentLoaded", function(){
const userInfo = JSON.parse(document.getElementById("userData").text);
console.log(userInfo);
})
<script id="userData" type="application/json">
{
"userId":1,
"userName":"Foo",
"memberSince":"2022-05-15"
}
</script>
They are scripting element where the type attribute is set to a value that is not