java - Is there a JSON library that can serialize Proxy objects? -


using activeobjects orm , gson json processor.

ran problem going tojson persisted objects. problem persisted class interface , ao proxying object under hood. here's sample code:

    venue venue = manager.get(venue.class, id);     gson.tojson(venue); 

comes exception:

java.lang.unsupportedoperationexception: expecting parameterized type, got interface java.lang.reflect.invocationhandler.  missing use of typetoken idiom?  see http://sites.google.com/site/gson/gson-user-guide#toc-serializing-and... 

because venue.getclass().getname() gives:

$proxy228

i've tried few solutions in various combinations:

    gsonbuilder.registertypeadapter(venue.class, newvenueserializer());     type listtype = new typetoken<venue>() {}.gettype(); 

nothing has worked far , i'm using wonky field-by-field workaround. suggestions? i'm not married gson, if there's alternative library can i'd happy use it.

flex json should work - use bean property introspector pull object, , assume proxy class implements properly.


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -