On Fri, 7 Aug 2020, Ryan Joseph via fpc-pascal wrote:
On Aug 7, 2020, at 8:31 PM, Michael Van Canneyt <mich...@freepascal.org> wrote:
An option to allow nulls to be detected and handles would of course be a nice
addition.
For the time being, you can just set jdoIgnorePropertyErrors on the destreamer
options.
Quick check right now and setting that option still seems to give the same
error. I'll look into it more tomorrow when I have some time. There's
seems to be a DoRestoreProperty override which could be interesting but
I'm not sure if the error is trigger before here or not.
try
B:=Not Assigned(FOnRestoreProp);
If Not B then
begin
FOnRestoreProp(Self,AObject,PropInfo,PropData,B);
If B then
exit;
end;
DoRestoreProperty(AObject,PropInfo,PropData);
except
On E : Exception do
If Assigned(FOnPropError) then
begin
B:=False;
FOnPropError(Self,AObject,PropInfo,PropData,E,B);
If Not B then
Raise;
end
else if Not (jdoIgnorePropertyErrors in Options) then
Raise;
end;
The exception will still be raised, but should be caught.
I added a jdoIgnoreNulls which changes the above to:
if (PropData.JSONType=jtNull) then
if Not (jdoIgnoreNulls in Options) then
DoRestoreProperty(AObject,PropInfo,PropData);
Committed in SVN. I will still add a jsoNullClearsProperty which will clear
the property using the 'natural' empty value (0, Nil, '' etc).
Michael.
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal