You are not logged in.
Pages: 1
I try to test ObjectToJSON function from TCollection object.
No JSON content generate from that object.
Then I track down to TJSONSerializer.WriteObject.
tkClass: begin
Obj := pointer(GetOrdProp(Value,pointer(P))); // works also for CPU64
if IsTSQLRecord then begin
if not P^.PropType^^.ClassType.InheritsFrom(TSQLRecordMany) then begin
HR(P);
Add(PtrInt(Obj));
end;
end else
if Obj<>nil then begin
HR(P);
if Obj.InheritsFrom(TCollection) then begin
HR;
...
...
Obj := pointer(GetOrdProp(Value,pointer(P))); // works also for CPU64
Always return nil to Obj. No JSON content generated
Offline
Two possibilities:
1. You try to serialize directly a TCollection object.
This is not handled yet: the TCollection must be a published property of another object.
So I've fixed this limitation. Now ObjectToJSON will be able to serialize directly a TCollection or a TStrings.
See http://synopse.info/fossil/info/8b22bf5bc8
2. It's because the TCollection instance is not existing in the published properties, IMHO.
You have to explicitly create the TCollection instance.
Take a look in SQLite3Commons.pas, in the TTestLowLevelTypes.EncodeDecodeJSON method.
You have here the regression tests about serialization of TCollTst.
They all passed with success with Delphi 2010.
Offline
I had also to update the reverse function.
Now JSONToObject will be able to unserialize directly a TCollection or a TStrings.
See http://synopse.info/fossil/info/97e16b4836
Offline
Pages: 1