Re: [Simple-support] JSON
Brought to you by:
niallg
|
From: Niall G. <gal...@ya...> - 2007-05-21 13:51:47
|
Hi Daniil, Currently the library is implemented with XML in mind. However should you wish to use the code to perform JSON serialization I think you could do it quite easily. I would recommend a new package such as "simple.json" and "simple.json.load" as attempting to build this into the framework could be a little difficult. To start the core functionality lies in the following classes: Traverser.java: This is where each class is prociessed in a depth first traversal, instantiation is done as a field/method is visited Composite.java: This is the core processing object, it makes use of the annotations to determine how to handle the parsing Scanner.java: This is where all reflective data is acquired and where the labels are created Label.java: This and all subclasses determine how the annotations are processed I think the code should be well documented so you should not have too much problems refactoring. Perhaps some slight changes to the Composite.java object and the simple.xml.stream package is all you need. I may take a look at this myself to see how much would be involved. Niall ----- Original Message ---- From: Daniil Sosonkin <da...@or...> To: sim...@li... Sent: Friday, May 18, 2007 12:28:45 AM Subject: [Simple-support] JSON Hi, I found SimpleXML library just recently and it is great. Saved me a lot of time. But I was just wondering if it would be possible to write a Serializer which will write not into XML format but into JSON format. This way one could switch between serialization on request without having to modify annotations (if not worse). It does seem to out of scope of SimpleXML since, as the name implies, it is designed to work with XML only. But nonetheless. I'd be glad to do it if given a few pointers. Daniil ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Simple-support mailing list Sim...@li... https://lists.sourceforge.net/lists/listinfo/simple-support ____________________________________________________________________________________ TV dinner still cooling? Check out "Tonight's Picks" on Yahoo! TV. http://tv.yahoo.com/ |