89

XML sucks. Why can't we just use JSON everywhere?

Comments
  • 4
    🙌
  • 5
    Shoutout to JSON
  • 7
    <?xml version="fuck yeah xml ftw" ?>
    <because>
    <reason>no other description-language <![CDATA[<escape/>]]>s more beautiful <![CDATA[^^]]>
    </because>
  • 21
    <j>
    <u>
    <s>
    <t>
    <b>
    <e>
    <a>
    <u>
    <t>
    <i>
    <f>
    <u>
    <l></l>
    </u>
    </f>
    </i>
    </t>
    </u>
    </a>
    </e>
    </b>
    </t>
    </s>
    </u>
    </j>
  • 2
    It's like you read my mind for the past several months of work.
  • 13
    There is a saying I usually say when I see bad things : "why do simple when you can overcomplicate ?"
  • 6
    Because the world existed before the 2000's and some stuff is not easy to refactor and rewrite?
  • 10
    Xml has metadata and has xml schema transformations. Two useful things against json.
  • 17
    Android layouts in json? hahahaha
  • 1
    In ruby you could XML.to_json Someone try that and let me know lol
  • 0
    How about XML with SOAP?
  • 0
    I just spent two days learning how to use json after never needing it before. I hate it already.
  • 8
    @monr0e JSON is described in its entirety in one single web page, and it's not a very long page: http://json.org/

    JSON is very concise and to the point, without all the bloat of XML. If you need 2 days and not 2 hours to learn it, someone must have directed you to the wrong resources.
  • 0
    Legacy systems come to mind
  • 0
    Good luck working with BizTalk and JSON.

    Actually, just good luck using BizTalk.
  • 2
    As always, it should depend on your needs. Don't forget that XML also works with XSLT and XSD, which cannot be done with JSON. JSON is just JSON, nothing to enforce some required format/schema, etc.
  • 2
  • 3
    Have you ever done html? Would you like to do that in json instead?
  • 2
    Just bashing on xml doesn't work, tell us how it sucks
  • 2
    @Grumpy I read about it a long time ago and completely forgot. So thank you very much for pointing that out to me! This time I should not forget ;)
  • 0
    @tomeb "Useful" ? I'd rather die than working on this kind of stuff again
  • 0
    @-FLX of course you can use other things to handle same requirements as xslt. Your taste, your freedom, your responsibility :)
  • 0
    @DrEmann if it's well indented then why not?
  • 4
    @matanl give it a try and compare.

    The extra semantics of (name, attributes, content) per tag vs. (attributes) make XML better for layout definition.
    {
    "kind": "p",
    "class": "x",
    "content": [
    "hi",
    { "kind": "span", "content": "there"}
    ]
    }
    vs
    <p class="x">
    hi<span>there</span>
    </p>
  • 0
    @DrEmann might be, however closing tags are absolutely redundant and time consuming in my opinion. I thought of mapping each tag as an object but then the tags must be unique, so put them in an array, like that:

    {
    'html': [
    {
    'head': [
    ...
    ]
    }, {
    'body': [
    ...
    ]
    }
    ]
    }

    Pretty confusing with all the tags. In my opinion building a tree should look like building a tree (i.e. a gui to generate html which saves time of writing start and end tags using keyboard shortcuts.)
    Maybe we just came up with a startup idea :)
  • 0
    JSON is the fucking best! But why the kitten I have to install an freaking API every Time?!
  • 3
    @matanl After half an hour I present to you: JSHTN, JavaScript Hypertext Notation.
  • 0
    @brod you missed the flaw I noticed, in your method 2 consequent divs will override one another since keys are unique
  • 0
    @matanl hmm, I thought I handled it with how those meta tags work but you're right.. arrays it is then!
  • 1
    @matanl @brod I was imagining something more like:

    [
    {
    'class': ['dogs']
    'content': [
    'fluffy',
    'pupper',
    { class: 'big', 'content': 'doggo' }
    ]
    }
    ]

    Everything by default is the equivalent of a div. When anything needs be different, it could be specified using 'type': 'textbox'.

    All head stuff could be in the top somewhere. It could work
  • 1
    @kyleperik tables would be a nightmare, apart from that it's neat!
  • 1
    @matanl who uses tables anyways! 😂
  • 0
    Always heard of it, but never rly looked into it. What's so good about json??
  • 1
    @jerichoi224 I'm simple and readable. JSON doesn't have quite the history that XML has though
Add Comment