Re: [json-lib-user] serializing to new <Object>(<parameters>)
Brought to you by:
aalmiray
From: Andres A. <aal...@ya...> - 2008-03-27 21:21:16
|
Yes, you can but it may not turn out to be exactly as you would expect. You can register a JsonBeanProcessor or a JsonValueProcessor that takes care of marshalling the property, you'll need to return a valid JSON value [JSON,null,Number,String,Boolean,JSONFunction] so in your case you'll return a String, something like "new Date( <params> )", which means that when the json string is deserialized on the browser the date won't be automatically created. Enabling arbitrary JS code as property value is a big no-no in many circles but I can clearly see the advantages of doing so, specially if you have the proper security measures in place. Perhaps this can be added as a feature. Cheers, Andres ------------------------------------------- http://jroller.com/aalmiray http://www.linkedin.com/in/aalmiray -- What goes up, must come down. Ask any system administrator. There are 10 types of people in the world: Those who understand binary, and those who don't. To understand recursion, we must first understand recursion. ----- Original Message ---- From: Costa Basil <cos...@ya...> To: jso...@li... Sent: Thursday, March 27, 2008 1:30:17 PM Subject: [json-lib-user] serializing to new <Object>(<parameters>) Is it possible, using json-lib, to serialize an object to a javascript new operator call. For instance, to serialize to a Date value, I would serialize it to new Date(<here go the constructor parameters>). Thanks Ask a question on any topic and get answers from real people. Go to Yahoo! Answers. ____________________________________________________________________________________ Looking for last minute shopping deals? Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping |