1

I have an object, say

O = {
    a1: instace_of_another_object,
    a2:100,
    a3:200
}

my a1 is inherited from another object say X.

How do I serialize and then deserialize O in such a way that I can call

O.a1.some_method() //which is part of X

If that is not possible, I am also Ok to store the object in localstorage proxy(which uses serialization). Is there a way I can "save" the whole object in "browser memory".

Thanks.

hrishikeshp19
  • 8,838
  • 26
  • 78
  • 141

1 Answers1

0

I don't know that you can do this with JSON.

You might want to look into using SOAP/REST.

You could also implement your own hydrator that takes certain properties from your JSON object and creates a new object using reflection (or simply setting values to properties)

Codeman
  • 12,157
  • 10
  • 53
  • 91
  • I have to do it client side, also I did not exactly understand how to use hydrator for JSON – hrishikeshp19 Jun 01 '12 at 00:51
  • Basically a hydrator just takes JSON/REST/SOAP elements and sets them to the properties of an object. Nothing too fancy :) You would just have to implement custom rules. – Codeman Jun 01 '12 at 15:47