the solution to your problem is $.extend() or jQuery.extend().
I'll give you an example below, but please also go to the jQuery
and for the JSON plugin to jQuery please read this:
eval("var p= " + jsonStringOfMyObject + ";");
dataFromServer = p;
fullyUsableClassAWithMethodsAndAll = new ClassA();
If you return more than one type of object form the server you'll have to make sure to create the appropriate instance before the $.extend() part.
I hope you could follow me :) .
If you have any doubts, check back with me.