Bug fix when deserialize object with custom type and JSON with null value

This commit is contained in:
joao.duarte 2019-01-10 14:30:40 -02:00
parent 303aa3d416
commit 8edd6241e6

View File

@ -531,8 +531,12 @@ begin
jdtNone:
Exit;
jdtObject:
GetTypeSerializers.Items[AValue.TypeInfo].DeserializeAttribute(AValue, AName, AJsonObject[AName].ObjectValue,
ACustomAttributes);
begin
/// <summary>JsonDataObjects assumes values null as jdtObject</summary>
if AJsonObject[AName].ObjectValue <> nil then
GetTypeSerializers.Items[AValue.TypeInfo].DeserializeAttribute(AValue, AName, AJsonObject[AName].ObjectValue,
ACustomAttributes);
end;
jdtArray:
GetTypeSerializers.Items[AValue.TypeInfo].DeserializeAttribute(AValue, AName, AJsonObject[AName].ArrayValue,
ACustomAttributes);