Browse Source

firemonkey android support beta

Unknown 7 năm trước cách đây
mục cha
commit
277269e504
1 tập tin đã thay đổi với 10 bổ sung4 xóa
  1. 10 4
      Quick.Json.Serializer.pas

+ 10 - 4
Quick.Json.Serializer.pas

@@ -7,7 +7,7 @@
   Author      : Kike Pérez
   Version     : 1.2
   Created     : 21/05/2018
-  Modified    : 08/07/2018
+  Modified    : 12/08/2018
 
   This file is part of QuickLib: https://github.com/exilon/QuickLib
 
@@ -587,7 +587,9 @@ begin
       else
         begin
           {$IFNDEF FPC}
-          rValue := DeserializeType(aObject,aProperty.PropertyType.TypeKind,aProperty.GetValue(aObject).TypeInfo,member.ToJSON);
+          //avoid return unicode escaped chars if string
+          if aProperty.PropertyType.TypeKind in [tkString, tkLString, tkWString, tkUString] then rValue := DeserializeType(aObject,aProperty.PropertyType.TypeKind,aProperty.GetValue(aObject).TypeInfo,member.JsonString.ToString)
+            else rValue := DeserializeType(aObject,aProperty.PropertyType.TypeKind,aProperty.GetValue(aObject).TypeInfo,member.ToJSON);
           {$ELSE}
           rValue := DeserializeType(aObject,aProperty.PropertyType.TypeKind,aName,member.ToJSON);
           if not rValue.IsEmpty then SetPropertyValue(aObject,aName,rValue);
@@ -791,11 +793,13 @@ begin
     tkFloat : Result := GetFloatProp(Instance,PropertyName);
     tkChar : Result := Char(GetOrdProp(Instance,PropertyName));
     {$IFDEF FPC}
+    tkWString : Result := GetWideStrProp(Instance,PropertyName);
     tkSString,
     tkAString,
+    {$ELSE}
+    tkWString,
     {$ENDIF}
     tkLString : Result := GetStrProp(Instance,pinfo);
-    tkWString : Result := GetWideStrProp(Instance,PropertyName);
     {$IFDEF FPC}
     tkEnumeration : Result := GetEnumName(pinfo.PropType,GetOrdProp(Instance,PropertyName));
     {$ELSE}
@@ -828,11 +832,13 @@ begin
     tkFloat : SetFloatProp(Instance,aPropInfo,aValue.AsExtended);
     tkChar : SetOrdProp(Instance,aPropInfo,aValue.AsOrdinal);
     {$IFDEF FPC}
+    tkWString : SetWideStrProp(Instance,aPropInfo,aValue.AsString);
     tkSString,
     tkAString,
+    {$ELSE}
+    tkWString,
     {$ENDIF}
     tkLString : SetStrProp(Instance,aPropInfo,aValue.AsString);
-    tkWString : SetWideStrProp(Instance,aPropInfo,aValue.AsString);
     {$IFDEF FPC}
     tkBool : SetOrdProp(Instance,aPropInfo,aValue.AsOrdinal);
     tkSet : LoadSetProperty(Instance,aPropInfo,aValue.AsString);