Thank You StateOne For Code But It Failed
----------
After I try Fix Code but incomplete, missing some value
I want results like this
result size = 3
index = 0, name = app_name, value = test
index = 1, name = app_date, value = 2022-01-01
index = 2, name = app_time, value = 12:30:40
How To Fix IT Show Name Or Add Class Component ??? Help Me Please !
Code How To Fix ???
procedure Form1_Button1_OnClick (Sender: TObject; var Cancel: boolean);
var
sl:TStringList;
jDataStream: TJSONObject;
jObject: TJSONObject;
i : int;
appindex,appname,appvalue:String;
begin
sl:=TStringList.Create;
sl.LoadFromFile(ExtractFilePath(Application.ExeName)+'\json.txt');
jDataStream := nil;
jDataStream := TJSONObject(TJSONObject.ParseJSONValue(sl.Text));
jObject := TJSONObject(jDataStream.GetPairByName('result').JsonValue);
Form1.Memo1.Text:=sl.text;
Form1.Memo2.Text:=''; //clear
if jDataStream <> nil then
Form1.Memo2.Lines.Add('result size ='+ IntToStr(jObject.Size)) ;
begin
For i := 0 To jObject.Size -1 Do
Begin
appindex := 'index = '+IntToStr(i);
appname := 'name = ' ;
appvalue := 'value = '+ TJSONString(jObject.GetPairByIndex(i).JsonValue).value ;
Form1.Memo2.Lines.Add(appindex+', '+appname+', '+appvalue) ;
End;
end;
sl.free
end ;
begin
end.
My Visual Database : I Love You
Easy For Beginner Student For Me