One sugestion: What if inform, in the deserialize() call the name of the root node in the json tree, as it's done in serialize()? Or make the deserialize "discover" the name of the root node?
In the example, deserialize(ms,"ms") 2011/12/3 Tommi Mäkitalo <[email protected]>: > On 12/03/2011 05:46 PM, Leandro Santiago wrote: >> Hello. I've seen you're adding a new json deserializer in cxxtools. >> I looked at the tests and there everything works fine. >> >> So I wrote a small program to test for myself. >> >> And I'm getting an exception when I try to deserialize a simple struct. >> >> My code is in http://pastebin.com/6keYWBwy >> >> The exception is: >> >> terminate called after throwing an instance of 'cxxtools::SerializationError' >> what(): serializationinfo.cpp:156: Missing info for 'age' >> Abortado >> >> As in my code I desialize an object and after I serialize using the >> same stream, I think it'd execute correctly. >> >> I'm using the revision 1342. >> >> Thanks in advance. >> > Hi, > > thank you for testing. It is really a interesting problem. > > The problem is, that it really creates a struct of structs. If you look > at the json output, you can see, that your top level struct has a member > "ms" in there, but no "age". > > This: http://pastebin.com/HLJLbTSE works. It adds a struct S, with a > member "ms", which is deserialized (Btw: it is always wise to add a > try-catch block in main like I did in this example). > > I think about how it can be fixed. Maybe there should be a > serialize-member in serializer without a name. Then it can create a > serialized representation of the actual object. I look at the code, if > it can be fixed. I'm sure the same is true for the xml serializer. > > Tommi > > ------------------------------------------------------------------------------ > All the data continuously generated in your IT infrastructure > contains a definitive record of customers, application performance, > security threats, fraudulent activity, and more. Splunk takes this > data and makes sense of it. IT sense. And common sense. > http://p.sf.net/sfu/splunk-novd2d > _______________________________________________ > Tntnet-general mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/tntnet-general -- Atenciosamente, Leandro ------------------------------------------------------------------------------ All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-novd2d _______________________________________________ Tntnet-general mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/tntnet-general
