|
@@ -71,7 +71,7 @@ type
|
|
|
TFPJSStream = TMemoryStream;
|
|
|
TJSONLargeInt = Int64;
|
|
|
{$else}
|
|
|
- TJSONCharType = AnsiChar;
|
|
|
+ TJSONCharType = Char;
|
|
|
TJSONVariant = jsvalue;
|
|
|
TFPJSStream = TJSArray;
|
|
|
TJSONLargeInt = NativeInt;
|
|
@@ -563,7 +563,7 @@ Type
|
|
|
{$ELSE}
|
|
|
function Add(I : NativeInt): Integer;
|
|
|
{$ENDIF}
|
|
|
- function Add(const S : AnsiString): Integer;
|
|
|
+ function Add(const S : TJSONStringType): Integer;
|
|
|
function Add: Integer;
|
|
|
function Add(F : TJSONFloat): Integer;
|
|
|
function Add(B : Boolean): Integer;
|
|
@@ -583,7 +583,7 @@ Type
|
|
|
{$ELSE}
|
|
|
procedure Insert(Index: Integer; I : NativeInt);
|
|
|
{$ENDIF}
|
|
|
- procedure Insert(Index: Integer; const S : AnsiString);
|
|
|
+ procedure Insert(Index: Integer; const S : TJSONStringType);
|
|
|
procedure Insert(Index: Integer; F : TJSONFloat);
|
|
|
procedure Insert(Index: Integer; B : Boolean);
|
|
|
procedure Insert(Index: Integer; AnArray : TJSONArray);
|
|
@@ -783,9 +783,13 @@ Function SetJSONInstanceType(AType : TJSONInstanceType; AClass : TJSONDataClass)
|
|
|
Function GetJSONInstanceType(AType : TJSONInstanceType) : TJSONDataClass;
|
|
|
|
|
|
Function StringToJSONString(const S : TJSONStringType; Strict : Boolean = False) : TJSONStringType;
|
|
|
+{$IFNDEF PAS2JS}
|
|
|
Function StringToJSONString(const S : UnicodeString; Strict : Boolean = False) : TJSONStringType;
|
|
|
+{$ENDIF}
|
|
|
Function JSONStringToString(const S : TJSONStringType) : TJSONStringType;
|
|
|
+{$IFNDEF PAS2JS}
|
|
|
Function JSONStringToString(const S : UnicodeString) : TJSONStringType;
|
|
|
+{$ENDIF}
|
|
|
Function JSONTypeName(JSONType : TJSONType) : String;
|
|
|
|
|
|
// These functions create JSONData structures, taking into account the instance types
|
|
@@ -995,13 +999,13 @@ begin
|
|
|
if SPos>SLastPos then
|
|
|
W(SLastPos,SPos-SLastPos);
|
|
|
end;
|
|
|
-{$ENDIF}
|
|
|
|
|
|
function StringToJSONString(const S: UnicodeString; Strict: Boolean
|
|
|
): TJSONStringType;
|
|
|
begin
|
|
|
Result:=StringToJSONString(UTF8Encode(S),Strict);
|
|
|
end;
|
|
|
+{$ENDIF}
|
|
|
|
|
|
function JSONStringToString(const S: TJSONStringType): TJSONStringType;
|
|
|
|
|
@@ -1132,12 +1136,12 @@ begin
|
|
|
MaybeAppendUnicode;
|
|
|
Result:=Result+Copy(S,J,I-J+1);
|
|
|
end;
|
|
|
-{$ENDIF}
|
|
|
|
|
|
function JSONStringToString(const S: UnicodeString): TJSONStringType;
|
|
|
begin
|
|
|
Result:=JSONStringToString(UTF8Encode(S));
|
|
|
end;
|
|
|
+{$ENDIF}
|
|
|
|
|
|
function JSONTypeName(JSONType: TJSONType): String;
|
|
|
begin
|
|
@@ -3069,7 +3073,7 @@ end;
|
|
|
|
|
|
{$ENDIF}
|
|
|
|
|
|
-function TJSONArray.Add(const S: AnsiString): Integer;
|
|
|
+function TJSONArray.Add(const S: TJSONStringType): Integer;
|
|
|
begin
|
|
|
Result:=Add(CreateJSON(S));
|
|
|
end;
|
|
@@ -3139,7 +3143,7 @@ begin
|
|
|
end;
|
|
|
|
|
|
|
|
|
-procedure TJSONArray.Insert(Index: Integer; const S: AnsiString);
|
|
|
+procedure TJSONArray.Insert(Index: Integer; const S: TJSONStringType);
|
|
|
begin
|
|
|
FList.Insert(Index, CreateJSON(S));
|
|
|
end;
|