Re:Show HN: This website is valid JSON
by mstade on Wednesday December 09, 2020 @12:35AM
(#25355700)
I'm guessing there might be issues with the streaming nature of html parsers then. If you put it at the top and the JSON is of any non-trivial size you might end up with the script trying to read invalid JSON since it's not fully loaded yet.
[ Parent
| on HN ]
Re:Show HN: This website is valid JSON
by jammaloo on Wednesday December 09, 2020 @01:12AM
(#25355845)
The script could be tied into the global onload event, so that it will only attempt to parse the JSON after the page has been fully loaded. Likely the HTML block is just placed at the bottom of the JSON for aesthetic reasons.
Re:Show HN: This website is valid JSON
by pjgalbraith on Wednesday December 09, 2020 @09:16PM
(#25368773)
They could just add the "defer" attribute on the script tag to prevent that.