Sfoglia il codice sorgente

* Proptype float gets priority

Michaël Van Canneyt 2 settimane fa
parent
commit
196a2c3331
1 ha cambiato i file con 9 aggiunte e 6 eliminazioni
  1. 9 6
      packages/fcl-web/src/base/restbase.pp

+ 9 - 6
packages/fcl-web/src/base/restbase.pp

@@ -1291,12 +1291,15 @@ begin
         else
           SetStringproperty(P,JSON.AsString);
       jtNumber  :
-        case TJSONNumber(JSON).NumberType of
-          ntFloat   : SetFloatProperty(P,JSON.asFloat);
-          ntInteger : SetIntegerProperty(P,JSON.asInteger);
-          ntInt64   : SetInt64Property(P,JSON.asInt64);
-          ntqword   : SetQWordProperty(P,JSON.asQWord);
-        end;
+        if P^.PropType^.Kind = tkFloat then
+          SetFloatProperty(P,JSON.AsFLoat)
+        else  
+          case TJSONNumber(JSON).NumberType of
+            ntFloat   : SetFloatProperty(P,JSON.asFloat);
+            ntInteger : SetIntegerProperty(P,JSON.asInteger);
+            ntInt64   : SetInt64Property(P,JSON.asInt64);
+            ntqword   : SetQWordProperty(P,JSON.asQWord);
+          end;
       jtNull    : ClearProperty(P);
       jtBoolean : SetBooleanProperty(P,json.AsBoolean);
       jtArray   :