-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
README.dpr
35 lines (30 loc) · 870 Bytes
/
README.dpr
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
program README;
uses
System.SysUtils,
System.JSON,
System.Rtti,
JSONRPC.Common.Types in 'Common\JSONRPC.Common.Types.pas',
JSONRPC.Common.Consts in 'Common\JSONRPC.Common.Consts.pas',
JSONRPC.Common.RecordHandlers in 'Common\JSONRPC.Common.RecordHandlers.pas',
JSONRPC.JsonUtils in 'Common\JSONRPC.JsonUtils.pas';
function get_data: TConstArray;
begin
Result := CreateConstArray(['hello', 5]);
end;
procedure Main;
begin
var data := get_data;
var LValue := TValue.From(data);
var LJSONArray := ValueToJSONArray(LValue, TypeInfo(TConstArray));
try
WriteLn(LJSONArray.ToJSON);
// let's assume it's a TConstArray to simplify conversion
DeserializeJSON(LJSONArray, TypeInfo(TConstArray), LValue);
finally
LJSONArray.Free;
end;
end;
begin
ReportMemoryLeaksOnShutdown := True;
Main;
end.