3 ms·
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</co
by crazygringo 14y ago
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.