Browse Source

* TJSJSON.Parse must return a JSValue, JSON spec was amended (https://tools.ietf.org/html/rfc7159)

michael 7 years ago
parent
commit
8082c6993e
3 changed files with 5 additions and 3 deletions
  1. 1 1
      demo/fcldb/demorest.lpr
  2. 1 1
      packages/fcl-db/db.pas
  3. 3 1
      packages/rtl/js.pas

+ 1 - 1
demo/fcldb/demorest.lpr

@@ -1,6 +1,6 @@
 program demorest;
 
-uses sysutils, classes, js, web, db, jsondataset, restconnection;
+uses sysutils, classes, js, web, db, extjsdataset, jsondataset, restconnection;
 
 Type
 

+ 1 - 1
packages/fcl-db/db.pas

@@ -3553,7 +3553,7 @@ Var
   B : TBookmark;
 
 begin
-  O:=TJSJSON.parse(Value);
+  O:=TJSJSON.parseObject(Value);
   B.Flag:=TBookmarkFlag(O.Properties['flag']);
   B.Data:=O.Properties['Index'];
   GotoBookMark(B)

+ 3 - 1
packages/rtl/js.pas

@@ -567,7 +567,9 @@ type
 
   TJSJSON = class external name 'JSON' (TJSObject)
   Public
-    class function parse(aJSON : String) : TJSObject;
+    class function parse(aJSON : String) : JSValue;
+    // Use this only when you are sure you will get an object, no checking is done.
+    class function parseObject(aJSON : String) : TJSObject; external name 'parse';
     class function stringify(aValue : JSValue) : string;
     class function stringify(aValue,aReplacer : JSValue) : string;
     class function stringify(aValue,aReplacer : JSValue; space:  NativeInt) : string;