TSQLTableJSON解析JSON

Posted 咏南中间件和开发框架

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了TSQLTableJSON解析JSON相关的知识,希望对你有一定的参考价值。

TSQLTableJSON解析JSON

uses mormot

rocedure TTestTableContent.SynopseTableVariant;
var json: RawUTF8;
people: variant;
list: TSQLTableJSON;
begin
json := StringFromFile(fFileName);
Owner.TestTimer.Start;
list := TSQLTableJSON.Create(‘‘,pointer(json),length(json));
while list.Step(false,@people) do begin
Check(people.FirstName<>‘‘);
Check(people.LastName<>‘‘);
Check(people.YearOfBirth<10000);
Check((people.YearOfDeath>1400)and(people.YearOfDeath<2000));
Check((people.ID>11011) or (people.Data<>‘‘));
end;
fRunConsoleOccurenceNumber := list.RowCount;
fRunConsoleMemoryUsed := MemoryUsed-fMemoryAtStart;
list.Free;
end;

procedure TTestTableContent.SynopseTableIndex;
var json: RawUTF8;
list: TSQLTableJSON;
i: Integer;
begin
json := StringFromFile(fFileName);
Owner.TestTimer.Start;
list := TSQLTableJSON.Create(‘‘,pointer(json),length(json));
for i := 1 to list.RowCount do begin
Check(list.Get(i,‘FirstName‘)<>nil);
Check(list.Get(i,‘LastName‘)<>nil);
Check(list.GetAsInteger(i,‘YearOfBirth‘)<10000);
Check((list.GetAsInteger(i,‘YearOfDeath‘)>1400)and(list.GetAsInteger(i,‘YearOfDeath‘)<2000));
Check((list.GetAsInteger(i,‘RowID‘)>11011) or (list.Get(i,‘Data‘)<>nil));
end;
fRunConsoleOccurenceNumber := list.RowCount;
fRunConsoleMemoryUsed := MemoryUsed-fMemoryAtStart;
list.Free;
end;

 





































以上是关于TSQLTableJSON解析JSON的主要内容,如果未能解决你的问题,请参考以下文章

sql解析嵌套json+数组

sql解析嵌套json+数组

Android 解析JSON

json串技术

Json解析

Json解析知多少