Json 文件內容(Ansing 格式 ):json
{ "blockCount":3, "blocks":[ {"FieldCount":3, "fields":[{"Name":"姓名", "Value":["張三", "張三","張三"]}, {"Name":"地址", "Value":["大慶","大慶","大慶"]}, {"Name":"年齡", "Value":["32", "32","32"]} ] }, {"FieldCount":3, "fields":[{"Name":"單位", "Value":["華拓", "張三","張三"]}, {"Name":"城市", "Value":["大慶","大慶","大慶"]}, {"Name":"工齡", "Value":["12", "12","12"]} ] }, {"FieldCount":1, "fields":[{"Name":"單位", "Value":["華拓", "張三","張三"]}]} ] } procedure TForm1.btn2Click(Sender: TObject); var js, j1, j2: TDocVariantData; str: RawUTF8; t, i: Cardinal; begin t := GetTickCount64; for i := 1 to 10000 do begin js.InitJSONFromFile('c:\DataA.json'); //Caption := j.GetValueByPath(['blockCount']); str := DocVariantData(js.GetValueByPath(['blocks'])).value[1]; // j1.InitJSON(str, JSON_OPTIONS_FAST_STRICTJSON); // str := DocVariantData(j1.GetValueByPath(['fields'])).value[1]; // j2.InitJSON(str, JSON_OPTIONS_FAST_STRICTJSON); // Caption := j2.U['Name'] + DocVariantData(j2.GetValueByPath(['Value'])).value[1]; str := DocVariantData(DocVariantData(js.A['blocks'].Value[1]).A['fields'].Value[1]).A['Value'].Value[1]; end; caption := str; str := inttostr(GetTickCount64-t); Showmessage(str); end;