title: Ensuring compatibility between both ends of a JSON-based web service
body: <p>With XML-based web-services, clunky as they are, there's WSDL, schemas, DTDs and other mechanisms to describe the data format and various tools for various languages not just to handle marshalling and unmarshalling but to generate corresponding classes.</p>
  
  <p>With JSON-based web services, marshalling and unmarshalling seem to be handled pretty well, but when it comes to enforcing interface contracts all you can do is code and pray (or test and pray).</p>
  
  <p>If you're developing both ends of a web service in two different languages -- Ruby and JavaScript, say -- and the domain is complicated enough that you're not willing to just deal with a lot of raw hashes, you want code completion and error checking and whatnot -- it seems like the only option is to write all the necessary classes, by hand, in both languages, and test the hell out of it to make sure that they're consistent both with each other and with the JSON representations each one is sending over the wire.</p>
  
  <p>Are there tools that make this easier? Are any of them worth using? Or is the approach we're talking about (i.e., matching class libraries on both sides) just wrong to begin with?</p>