cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
dfaultkey
New member
Status: New idea

HTML has been the long standing data format for representing the layout of a webpage, but why is that? We all know from experience that XML like data is unnecessarily verbose and is a pure waste of data(in terms of data in wire) and time(in terms of parsing it to construct the dom). Why don't we render data with json?

DOM data in json is very much appealing to the eyes compared to XML like representation. It makes developers lives easier. And accessing data in html from js would be a breeze.

Has anyone considered this possibility? Why not use something that can significantly increase the performance and the developer experience?

11 Comments
Status changed to: New idea
Jon
Community Manager
Community Manager

Thanks for submitting an idea to the Mozilla Connect community! Your idea is now open to votes (aka kudos) and comments.

ovanes1
New member

I'm interested in that too.

Anonymous
Not applicable

A similar alternative exists for rss/atom feeds. ( ref. http://jsonfeed.org/ )

g_h_97
New member

Using JSON nowadays is absolutely a must. Props,

Deesan
New member

{
   "html": {
        "head": {
              "title": "My title",
              "link": {
                        "href": "json.com/style.css"
              }
         },
        "body": {
              "div": "Hello world"
         }
    }
}
HTML to JSON would be something like this? Yeah. It would eliminate the size. Appealing to eyes?

dfaultkey
New member

<head>
    <title>My title</title>
    <link href="json.com/style.css"/>
</head>
<body>
    <div>
        Hello World
    </div>
</body>
</html>

@Deesan  The equivalent in HTML. IMHO JSON is much cleaner and easier to read compared to this. JSON has readability problems too. There are some efforts by people like the https://json5.org/ project to improve JSON but one can only hope so much.

Jagathish
New member

 

I'm interested in that too.

Anonymous
Not applicable

Why stop ad JSON?  Lets go full YAML ( ref. https://docs.fileformat.com/programming/yaml/ )

 

html:
  head:
    title: My title
    link:
      href: json.com/style.css
  body:
    div: Hello world

 

Can't get any smaller than this, without making it less readable.

NunoSempere
New member

This seems like an interesting proposal. What work would someone need to do to provide a minimal proof of concept? Write a simple json to html compiler?

dfaultkey
New member

@AnonymousJSON is already part of the browser and used for data exchange. Using it for html rendering would makes developers life easier. Even though we have good things like pug and yaml, using those would mean that the developers have to learn yet another syntax.