Skip to content

Commit d6abc32

Browse files
committed
[serialize] Added options
1 parent 0216789 commit d6abc32

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

Quick.Core.Serialization.Abstractions.pas

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{ ***************************************************************************
22
3-
Copyright (c) 2016-2020 Kike Pérez
3+
Copyright (c) 2016-2022 Kike Pérez
44
55
Unit : Quick.Core.Serialization.Abstractions
66
Description : Core Serialization Abstractions
77
Author : Kike Pérez
88
Version : 1.0
99
Created : 22/02/2020
10-
Modified : 11/09/2020
10+
Modified : 17/05/2022
1111
1212
This file is part of QuickCore: https://github.com/exilon/QuickCore
1313
@@ -35,7 +35,8 @@ interface
3535

3636
uses
3737
System.SysUtils,
38-
System.Rtti;
38+
System.Rtti,
39+
Quick.Serializer.Intf;
3940

4041
type
4142

@@ -51,6 +52,7 @@ interface
5152
function ToObject(aType : TClass; const aSerialized: string) : TObject; overload;
5253
function ToObject(aObject : TObject; const aSerialized: string) : TObject; overload;
5354
//function ToArray<T>(const aYaml : string) : TArray<T>;
55+
function Options : TSerializerOptions;
5456
end;
5557

5658
implementation

Quick.Core.Serialization.Json.pas

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{ ***************************************************************************
22
3-
Copyright (c) 2016-2020 Kike Pérez
3+
Copyright (c) 2016-2022 Kike Pérez
44
55
Unit : Quick.Core.Serializer.Json
66
Description : Core Json Serializer
77
Author : Kike Pérez
88
Version : 1.8
99
Created : 12/10/2019
10-
Modified : 18/06/2020
10+
Modified : 17/05/2022
1111
1212
This file is part of QuickCore: https://github.com/exilon/QuickCore
1313
@@ -57,6 +57,7 @@ TJsonSerializer = class(TInterfacedObject,ISerializer)
5757
function ToObject(aObject : TObject; const aJson: string) : TObject; overload;
5858
function ToArray<T>(const aJson : string) : TArray<T>;
5959
function ToValue(const aJson : string) : TValue;
60+
function Options : TSerializerOptions;
6061
end;
6162

6263
implementation
@@ -66,6 +67,7 @@ implementation
6667
constructor TJsonSerializer.Create;
6768
begin
6869
fSerializer := Quick.Json.Serializer.TJsonSerializer.Create(TSerializeLevel.slPublicProperty,True);
70+
fSerializer.UseGUIDLowerCase := True;
6971
end;
7072

7173
destructor TJsonSerializer.Destroy;
@@ -104,6 +106,11 @@ function TJsonSerializer.FromValue(aValue: TValue; aIndent: Boolean): string;
104106
Result := fSerializer.ValueToJson(aValue,aIndent);
105107
end;
106108

109+
function TJsonSerializer.Options: TSerializerOptions;
110+
begin
111+
Result := fSerializer.Options;
112+
end;
113+
107114
procedure TJsonSerializer.SetSerializationLevel(const Value: TSerializationLevel);
108115
begin
109116
fSerializer.SerializeLevel := Quick.Json.Serializer.TSerializeLevel(Integer(Value));

0 commit comments

Comments
 (0)