Browse Source

* Remove erroneous space in front of float number

git-svn-id: trunk@23668 -
michael 12 years ago
parent
commit
d02f0b3f54
1 changed files with 7 additions and 4 deletions
  1. 7 4
      packages/fcl-json/src/fpjson.pp

+ 7 - 4
packages/fcl-json/src/fpjson.pp

@@ -945,6 +945,9 @@ end;
 function TJSONFloatNumber.GetAsString: TJSONStringType;
 begin
   Str(FValue,Result);
+  // Str produces a ' ' in front where the - can go.
+  if (Result<>'') and (Result[1]=' ') then
+    Delete(Result,1,1);
 end;
 
 procedure TJSONFloatNumber.SetAsString(const AValue: TJSONStringType);
@@ -1308,7 +1311,7 @@ begin
     begin
     Result:=Result+Items[i].AsJSON;
     If (I<Count-1) then
-      Result:=Result+', '
+      Result:=Result+','
     end;
   Result:=Result+']';
 end;
@@ -1787,11 +1790,11 @@ begin
   For I:=0 to Count-1 do
     begin
     If (Result<>'') then
-      Result:=Result+', ';
-    Result:=Result+'"'+StringToJSONString(Names[i])+'" : '+Items[I].AsJSON;
+      Result:=Result+',';
+    Result:=Result+'"'+StringToJSONString(Names[i])+'":'+Items[I].AsJSON;
     end;
   If (Result<>'') then
-    Result:='{ '+Result+' }'
+    Result:='{'+Result+'}'
   else
     Result:='{}';
 end;