JSON x Web Services

1

1 - What is the difference of JSON for Web Services? (Only the format type on return)?

2 - In terms of performance, which would be better?

3 - In practice should I use JSON (with a php or java file for example) to integrate my applications directly with AJAX or Mobile (Ios and Android) and Web Services when I want other people to have access to it? >

Thank you

    
asked by anonymous 15.03.2016 / 20:48

2 answers

2

It's not a matter of "difference."

Web services are "API's" for accessing data through HTTP protocol. Any form of HTTP communication to transfer data between applications can be called web service.

There are several ways to structure your "API" using HTTP as a means of transport. The industry has developed and adopted SOAP , using a huge set of protocols to exchange information over XML over HTTP. SOAP has gained a very corporate bias and has become complex, so some developers adopt XML-RPC , which is more informal

Initially, XML was used even when the API client was a web application in a browser, but eventually dropped the plug that decoding XML in the browser was too cumbersome and would be simpler to deliver the content to JSON , which is nothing more than the native Javascript data structure.

So JSON is just the data transfer format used by web services. If your web services are consumed by applications in browsers, it is only natural that you choose JSON. If consumed by other applications, maybe XML makes more sense. Because the two are just formats for the same information, the development frameworks (Rails, for example) usually allow the same web service to return JSON or XML according to the client's request.

    
15.03.2016 / 21:29
0

You're confusing things. Web service is an access point from a device (a server for example) to other devices (browsers or other servers) in the WWW, since JSON is a format for data representation. Webservices can use JSON or some other format (XML, YAML, HTML, plain text, etc.) to transmit data, or can accept input data in some (or several) of these formats.

The question you want to ask is probably "which communication protocol should I use for my webservice, REST, SOAP, or other?" and "what format of data transfer would be most advised?", in which case my advice is to use REST as protocol (which is basically just HTTP) and JSON as data format.

    
15.03.2016 / 21:21