News for hackers. Stuff that matters.
Re:Using HTML as the Media Type for your API by crazygringo on Wednesday July 11, 2012 @10:02AM (#4229217)
I think one of the big reasons that JSON took off is because it removed the attribute/value dilemma, e.g. should I do this:

  <color pattern="checked">blue</color>
or this:

  <color>
    <pattern>checked</pattern>
    <value>blue</value>
  </color>
or even this:

  <color value="blue" pattern="checked" />
And lots of variations. JSON simplified everything into just maps and arrays, so there's one straightforward, simple way to do it.

Using HTML for your API response re-introduces all the confusion as to what to put where, and now you've got to decide which random HTML tag to use for which element. For 99% of the cases, I see no benefit to it.

The only thing I think of is if you're returning a very large and complex data set, and you want to take advantage of jQuery/similar to use selectors to extract certain patterns of data, which could be a cool thing do to. Have to say, I've never needed that before, though.

There are no comments on this comment yet.