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.