Hacker News new | ask | show | jobs
by talmand 4488 days ago
I don't think your example needs to be quite so verbose.

  {
    'ul': {
      'li': 'hello!'
    }
  }
I would think it would depend upon the parser.

Regardless, I'd still rather write out HTML instead of JSON for markup.

2 comments

That breaks down as soon as you have something with attributes, and it breaks down even further once you have something like:

  <p>Example <b>text</b></p>
You see, this is why I don't create standards.

I'm going to go with that JSON is the failure point with my grand vision.

Not sure your example would work in a real world situation. The UL would probably have an array attached as it can have multiple children. Then we get into the fact that all tags can have attributes, not just a text node.
You're right, I didn't consider attributes. In my simplified way the parser would need to know which keywords were attributes based on parent element versus keywords that are just new children elements. Which would defeat the purpose.

I guess I'm not changing the world today.

There's always tomorrow!
Nah, I need time to recover from this dismal failure and to reflect. Maybe next Tuesday.