Merge pull request #180 from joaoduarte19/serializer

Bug fix when deserialize object with custom type and JSON with null value
This commit is contained in:
Daniele Teti 2019-01-10 23:27:22 +01:00 committed by GitHub
commit 5981905c0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -531,8 +531,12 @@ begin
jdtNone: jdtNone:
Exit; Exit;
jdtObject: jdtObject:
GetTypeSerializers.Items[AValue.TypeInfo].DeserializeAttribute(AValue, AName, AJsonObject[AName].ObjectValue, begin
ACustomAttributes); /// <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: jdtArray:
GetTypeSerializers.Items[AValue.TypeInfo].DeserializeAttribute(AValue, AName, AJsonObject[AName].ArrayValue, GetTypeSerializers.Items[AValue.TypeInfo].DeserializeAttribute(AValue, AName, AJsonObject[AName].ArrayValue,
ACustomAttributes); ACustomAttributes);