from Hacker News

Ask HN: What can JSON do that HTML can't?

by drzel on 1/25/21, 1:18 PM with 7 comments

Just wondering, if HTML is indeed a data format, with some extra rendering stuff as a bonus, is there anything that JSON can do that HTML can't?
  • by tony-allan on 1/25/21, 1:55 PM

    They are both just data formats. HTML, derived from XML, is a data format that can be read by the browser to display information to users; JSON is data format that can be read and written by almost every programming language, including JavaScript running on a server or in a the browser.

    HTML is just as capable of storing data, for example microformats. In practice though, it is easier to use HTML to describe the contents of a web page for a user and JSON to exchange data between programs.

    https://developer.mozilla.org/en-US/docs/Web/HTML/microforma...

  • by pharzan on 1/25/21, 2:09 PM

    None of them alone can't do anything and they are used for total different purposes. You can organize the data in a way to include the same information stored in the data's.
  • by getcrunk on 1/26/21, 3:26 AM

    If your primarily moving and manipulating that data imo json is easier to work with (less loc)
  • by speedgoose on 1/25/21, 2:45 PM

    Be easily parsed.
  • by solus_factor on 1/25/21, 1:39 PM

    Be smaller.