Re: JSON serialization

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Thu May 20 2010 - 14:48:40 UTC

  • Next message: Kuhns, John: "RE: JSON serialization"

    Yes, if you do it uncontrolled, it can become a problem. I started a
    prototype of a smarter serialization framework (based on XStream BTW)
    to solve this exact problem:

      https://svn.apache.org/repos/asf/cayenne/sandbox/cayenne-
    serialization/

    The main idea is to define a subgraph of the model to serialize and
    let Cayenne/XStream do the work. In a way it is similar to how
    prefetches are specified - a bunch of path's from the root entity:

    Subgraph<Table2> subgraph = new Subgraph<Table2>(Table2.class,
    context.getEntityResolver());
    subgraph.addClonePath(Table2.TABLE1_PROPERTY);

    XStreamSerializer serializer = new XStreamSerializer();
    serializer.serialize(object, subgraph, out);

    The prototype has a few unresolved issues and I currently have no time
    to deal with them, but the idea looks solid.

    Andrus

    On May 20, 2010, at 5:38 PM, Juergen Saar wrote:

    > Years ago we implermented a serialization into xml ... if not only
    > attributes, but also relations are serialized, you run into deep
    > trouble ...
    > we stopped this experiment ...
    >
    > 2010/5/20 Kuhns, John <jkuhn..imntls.com>
    >
    >> I am looking for the best method of serializing/de-serializing
    >> CayenneDataObjects as JSON. I've written my own class for now, but am
    >> interested in hearing about a good method to use either XStream,
    >> Jackson or
    >> some other library.
    >>
    >> John Kuhns
    >>
    >>



    This archive was generated by hypermail 2.0.0 : Thu May 20 2010 - 14:49:08 UTC