3

Since JSON shows a lot of benefits over HTML, why don't just abandon HTML? Qt frameworks with QML shows it is perfectly possible to use JSON to design rich content

EDIT:

Many of you think about this question in terms of performance vs html but i'm not about that.

HTML is just less readable and it's not enough per-se to describe UI behavior, look and feel. Maybe a technology shift is needed. I think from the developer point of view.

What about a browser capable of rendering a QML like web-page for example? QT with QML uses google V8 engine to do its work.

If you can write a web page in a technology that is not HTML, people will start using it. Browser could support HTML for a long time and allow developers to code with less stress

  • 6
    I have a better question. Why? – Randy Minder Nov 6 '14 at 16:13
  • 3
    What benefits did you have in mind? Expand on them please. – occulus Nov 6 '14 at 16:14
  • 2
    legacy and inertia, 2 of the most powerful forces in computer development – ratchet freak Nov 6 '14 at 16:14
  • 2
    Another justification would be the horror that HTML represents as a terrible, cancerous spec that has not so much evolved over time as consumed the internet with the same relationship that Godzilla enjoys with Tokyo. – Rob Nov 6 '14 at 16:23
  • 7
    JSON is a data interchange format. It is a category error to compare it with HTML. If you intend to use HTML DOM concepts and identifiers, implying HTML definitions for them, you are just referring to the serialization of HTML (the syntax used to linearize elements to a string of text). – Jukka K. Korpela Nov 6 '14 at 16:58
5

You are assuming JSON is always better than HTML, which is controversial at best (see MainMa's answer). But let's assume you're right. Why don't we get rid of HTML?

The surface answer is compatibility, but why is compatibility even an issue? The fundamental reason you can't make these kinds of changes on the web is because the web is a decentralized system built on communication protocols. So even if a majority of the web switched to JSON tomorrow, any cohort of the web still using HTML could function. There is no central switch.

|improve this answer|||||
3

While JSON has a benefit in terms of size (and so bandwidth) and simplicity (slightly easier to parse for smartphones), such major change of replacing one language by another would be too disruptive to justify the minor gains in bandwidth and performance. Such gains were maybe relevant ten years ago where mobile devices were very limited in terms of CPU and when many people had only access to low-speed internet, but today, it's much less relevant.

If you're not convinced, take an ordinary e-commerce website, measure the time spent:

  1. Downloading and parsing (sometimes minified and usually gzipped and cached on client side) HTML.

and compare it to the time it takes to:

  1. Download minified JavaScript source,
  2. Download images,
  3. Download CSS,
  4. Parse CSS,
  5. Render the page,
  6. Execute JavaScript.

Now, if you identified that after minifying HTML, gziping it and adding client-side caching, the loading and the parsing of HTML is still the bottleneck on your website, nothing forbids you, using current standards, to make a fully AJAX website, sending practically only JSON to your users.

|improve this answer|||||
  • 1
    "nothing forbids you, using current standards, to make a fully AJAX website, sending practically only JSON to your users" And then you have customers who don't want any javascript, just sayin ;) – Knerd Nov 6 '14 at 16:33
  • I don't care about performance, i look at this from the developer point of view. Today web programming is very messy – Mauro Sampietro Nov 7 '14 at 14:44
  • The question is not about HTML vs dynamically constructing a webpage using JS + JSON, it's about moving from HTML to JSON as the language parsed by browsers. – Telmo Marques Nov 13 '19 at 13:00
1

Because the change would bring more pain than benefit.

Let's assume that you are right and that JSON is better than HTML for the job of defining web pages. Well, okay, but that's not enough to justify the change. There would have to be tangible benefit. Maybe raw web pages would be easier to maintain and quicker to download -- but we mostly don't edit raw HTML anymore, and download time is mostly about server load and media size.

On the other hand, the cost of change would be horrific.

Sorry to be cynical, but there (IMO) you go.

|improve this answer|||||

Not the answer you're looking for? Browse other questions tagged or ask your own question.