Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

IMO, you made the JSON unreadable with all the extra whitespace that you didn't add to the XML.

    {"note": 
      {"paragraph": 
        ["This is a ", {"code": [{"vibe":"positive"}, "remarkable"]}, "text."]
      }
    }
Also, in this particular case I think the child/property dichotomy works in the favor of XML, but typically I find it to be more of a liability than an asset.


If you use arrays instead of objects, it becomes JsonML[1]:

    ["note",
        ["paragraph",
            "This is a ", ["code", {"vibe": "positive"}, "remarkable"], " text."]]
[1]: https://en.wikipedia.org/wiki/JsonML

This is also why I find Mithril.js so pleasant to use without JSX, because it's basically JsonML.


Use parens and you have S-expressions. No need for all that noise.

    (note
      (paragraph
        "This is a " (code (:vibe . "positive") "remarkable") " text."))
Lisp was invented in 1958 and we routinely rediscover it, and reimplement it badly.


Yeah, S-expressions are way more pleasant to write.

With the benefit of a lot of hindsight, S-expressions seem like a superior choice for writing web applications (instead of HTML + JavaScript + some JS framework that writes HTML again (regardless of DOM vs Virtual DOM)).

Even though I prefer dialects like Fennel for programming rather than Common Lisp (I'd probably be fine with Clojure and Janet as well, but I haven't tried them), I wouldn't mind any dialect if that means I could use S-expressions instead of HTML+JS, assuming the amount of effort put into sandboxing that approach were as much as the effort that has been put into the current approach.


I love Lisp, but the quotes, and the structure ... Markup really shines here. Sorry. Same with JsonML, even though I never heard of it before, and will have a look because it just sounds so interesting.


How do you parse such JSON?

A "note" contains a "paragraph" object, which is an array of...? Strings, or objects where there are keys, but the values are arrays of...?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: