My web service returns objects with single-letter property names. Because I want to use readable properties in my JavaScript code, I usually do a procedure similar to this:
$.getJSON('bla').done(res => {
myResult = {
hello: res.h,
world: res.w
};
});
Or
$.getJSON('bla').done(res => {
res.hello = res.h; delete res.h;
res.world = res.w; delete res.w;
myResult = res;
});
An additional problem is, that I have to repeat that procedure the other way around, when I want to call back that object to the server.
Therefore my question is, if there is some kind of a simplified, bi-directional mapper method, or something like an implicit cast operator.