News for hackers. Stuff that matters.
Re:Show HN: This website is valid JSON by pjgalbraith on Tuesday December 08, 2020 @09:18PM (#25354564)
In regards to the character encoding issue, I wonder if they could just move the #render to the top of the object by inserting it as the first property.
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.
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.