On 8/1/2017 7:34 AM, Mukul Gandhi wrote:
> When talking about designing REST services, JSON seems to clearly win.
> The whole software world seems to be biased in favour of JSON it seems,
> for this criteria. Although I have read, that in many cases REST
> services can use XML instead of JSON. I think, JSON's major use case is
> in the use within REST.
REST has nothing to do with either XML or JSON, and the concept of REST
was solidified way before JSON existed. In REST, you receive a request,
which for a long time was usually a web form - that is, content type =
application/x-www-form-urlencoded - and in response you emit a document
which represents some part of the state known to the server. The
document can be text, XML, JSON, or something else.
You personally may think it is "easier" to extract the data from a JSON
response compared with an XML response, or you personally may happen to
encounter more JSON interfaces, but others have different experiences
and would be happier with XML or something else. It has little to do
with being REST or not.
TomP