#1 2014-07-20 16:00:48

martin.suer
Member
Registered: 2013-12-15
Posts: 76

mORMot.JSONToObject issue with object containing a record field

Hi AB,

using XE5 and the nightly build downloaded this morning,

I have a TSQLRecord descendant that contains a collection field. That collection contains derived CollectionItems. The derived CollectionItem class contains a field that is a record.

Serializing my TSQLRecord descendant to the DB works nicely. And since I use XE5, the record field in the collectiontem object is serialized nicely to json without any further registration calls beforehand.

However unserializing that TSQLRecord doesn't work. The collection isn't unserialized because in mORMot.JSONToObject in Line 31397:

        if Kind<>tkClass then
          exit; // true nested object should begin with '[' or '{' 

Kind contains tkRecord and so at that point JSONToObject exits.

So in other words I can write my TSQLRecord to the db but can't read it because JSONToObject does expect a class. A Record is not supported there.
Would be great if that's added there.

What do you think?

Martin

Offline

#2 2014-07-20 17:59:05

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: mORMot.JSONToObject issue with object containing a record field

Could you please create a ticket?

Offline

#3 2014-07-20 21:37:03

martin.suer
Member
Registered: 2013-12-15
Posts: 76

Re: mORMot.JSONToObject issue with object containing a record field

Created the ticket with attached sample code to reproduce the problem.

Offline

#4 2014-07-20 23:45:43

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: mORMot.JSONToObject issue with object containing a record field

Thanks a lot for the feedback.

Offline

#5 2014-07-25 14:59:18

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: mORMot.JSONToObject issue with object containing a record field

Should be fixed now.
See http://synopse.info/fossil/info/c7899aa6a1c79

Thanks for the patch!

Offline

Board footer

Powered by FluxBB