An alternative approach is to use something like Thrift to type your responses —- properly implemented, an RPC framework like that is amazing. So much validation boilerplate removed on the backend, and receiving it on the frontend as a nice type is fabulous as well.