Browse Source

fcl-json: fixed writing boolean lowercase, as expected by reader

git-svn-id: trunk@47040 -
Mattias Gaertner 4 years ago
parent
commit
65bcfe36b3
2 changed files with 4 additions and 4 deletions
  1. 1 1
      packages/fcl-json/src/fpjson.pp
  2. 3 3
      packages/fcl-json/tests/testjsondata.pp

+ 1 - 1
packages/fcl-json/src/fpjson.pp

@@ -1796,7 +1796,7 @@ end;
 
 function TJSONBoolean.GetAsString: TJSONStringType;
 begin
-  Result:=BoolToStr(FValue, True);
+  Result:=BoolToStr(FValue, 'true', 'false');
 end;
 
 procedure TJSONBoolean.SetAsString(const AValue: TJSONStringType);

+ 3 - 3
packages/fcl-json/tests/testjsondata.pp

@@ -19,7 +19,7 @@ unit testjsondata;
 interface
 
 uses
-  Classes, SysUtils, fpcunit, testregistry, fpjson, contnrs;
+  Classes, SysUtils, fpcunit, testregistry, fpjson;
 
 type
    TMyNull     = Class(TJSONNull);
@@ -1311,7 +1311,7 @@ begin
     TestAsInteger(J,1);
     TestAsInt64(J,1);
     TestAsQword(J,1);
-    TestAsString(J,BoolToStr(True,True));
+    TestAsString(J,BoolToStr(True,'true','false'));
     TestAsFloat(J,1.0);
   finally
     FreeAndNil(J);
@@ -1334,7 +1334,7 @@ begin
     TestAsInteger(J,0);
     TestAsInt64(J,0);
     TestAsQWord(J,0);
-    TestAsString(J,BoolToStr(False,True));
+    TestAsString(J,BoolToStr(False,'true','false'));
     TestAsFloat(J,0.0);
   finally
     FreeAndNil(J);