mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-30 15:40:16 +02:00
* Fix wrong typecast, fix warning when compiling
git-svn-id: trunk@41162 -
This commit is contained in:
parent
0db9ff5c39
commit
85f1b78162
@ -5,7 +5,7 @@ unit fpjsonrtti;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, contnrs, typinfo, fpjson, rttiutils, jsonparser;
|
Classes, SysUtils, contnrs, jsonscanner, typinfo, fpjson, rttiutils, jsonparser;
|
||||||
|
|
||||||
Const
|
Const
|
||||||
RFC3339DateTimeFormat = 'yyyy"-"mm"-"dd"T"hh":"nn":"ss';
|
RFC3339DateTimeFormat = 'yyyy"-"mm"-"dd"T"hh":"nn":"ss';
|
||||||
@ -68,6 +68,7 @@ Type
|
|||||||
// If AObject is of type TStrings or TCollection, special treatment occurs:
|
// If AObject is of type TStrings or TCollection, special treatment occurs:
|
||||||
// TStrings results in { Strings: [S,S,S] } or { Strings: { "S1" : O1, "S2" : O2 }} depending on Options.
|
// TStrings results in { Strings: [S,S,S] } or { Strings: { "S1" : O1, "S2" : O2 }} depending on Options.
|
||||||
// Collection results in { Items: [I,I,I] }
|
// Collection results in { Items: [I,I,I] }
|
||||||
|
// Tlist/TObjectlist results in { "Objects": [O1,O2,O3] }
|
||||||
Function ObjectToJSON(Const AObject : TObject) : TJSONObject;
|
Function ObjectToJSON(Const AObject : TObject) : TJSONObject;
|
||||||
// Stream a collection - always returns an array
|
// Stream a collection - always returns an array
|
||||||
function StreamCollection(Const ACollection: TCollection): TJSONArray;
|
function StreamCollection(Const ACollection: TCollection): TJSONArray;
|
||||||
@ -217,7 +218,7 @@ Type
|
|||||||
function TJSONDeStreamer.ObjectFromString(const JSON: TJSONStringType): TJSONData;
|
function TJSONDeStreamer.ObjectFromString(const JSON: TJSONStringType): TJSONData;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
With TJSONParser.Create(JSON) do
|
With TJSONParser.Create(JSON,[joUTF8]) do
|
||||||
try
|
try
|
||||||
Result:=Parse;
|
Result:=Parse;
|
||||||
finally
|
finally
|
||||||
@ -777,7 +778,7 @@ begin
|
|||||||
else If AObject is TObjectList then
|
else If AObject is TObjectList then
|
||||||
Result.Add('Objects',StreamObjectList(TObjectList(AObject)))
|
Result.Add('Objects',StreamObjectList(TObjectList(AObject)))
|
||||||
else if (jsoStreamTlist in Options) and (AObject is TList) then
|
else if (jsoStreamTlist in Options) and (AObject is TList) then
|
||||||
Result := TJSONObject(StreamTList(TList(AObject)))
|
Result.Add('Objects', StreamTList(TList(AObject)))
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
PIL:=TPropInfoList.Create(AObject,tkProperties);
|
PIL:=TPropInfoList.Create(AObject,tkProperties);
|
||||||
|
Loading…
Reference in New Issue
Block a user