4 ms·
Also, unless you have a very good reason for doing otherwise, please include a JSON version of your API. JSON libraries are just about ubiquitous and it causes
by phpnode 16y ago
Also, unless you have a very good reason for doing otherwise, please include a JSON version of your API. JSON libraries are just about ubiquitous and it causes far, far less pain than SOAP.
- mseebach 16y agoI think you mean XML instead of SOAP. A JSON version of a SOAP service would be a completely different API. Except for consuming the API directly in a browser, there's little reason that XML should cause you pain.
- ZoFreX 16y agoThe only applications I've made that interface with JSON or XML APIs were in Java, and JSON was less headache every time. GSON makes it trivial to marshall/unmarshall, and I haven't found an equivalent XML library - not for lack of trying!
- mccutchen 16y ago> Except for consuming the API directly in a browser, there's little reason that XML should cause you pain. I disagree. Unless the data I'm working with are awkward/difficult to represent in JSON (ie, they're highly structured documents, for which XML is ideal), XML is always more painful to work with. More painful to produce and to consume. This is working primarily with Python and Javascript.
- jbrennan 16y agoI can echo this for working on iOS with Cocoa touch as well. While there's no native JSON provided by Cocoa touch, there are excellent third-party tools. XML in iOS is a beast, and a real pain to read (and I've never attempted to write it). Plus, on mobile devices especially, XML is slower to download because it is more verbose than the equivalent JSON object. So I agree, unless you need a highly structured document, I always go with JSON over XML.
- phpnode 16y agonot really, JSON makes it easy to exchange standard objects and arrays between languages, in PHP it's as simple as: $json = json_encode($object); $object = json_decode($json); I'm sure it's equally easy in other languages, XML is not good in this use case. There's no standard way to do it.