JSON how do I extract this lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- vonskie · 2017-08-21 01:51 Here is a sample dataset "timestamps_int": {         "23": [             20170820235522,             20170820235022,             20170820234522,             20170820234022,             20170820233522,             20170820233022,             20170820232522,             20170820232022,             20170820231522,             20170820231022,             20170820230522,             20170820230022         ],         "22": [             20170820225522,             20170820225022,             20170820224522,             20170820224022,             20170820223522,             20170820223022,             20170820222522,             20170820222022,             20170820221522,             20170820221022,             20170820220522,             20170820220022         ],         "21": [             20170820215522,             20170820215022,             20170820214522,             20170820214022,             20170820213522,             20170820213022,             20170820212522,             20170820212022,             20170820211522,             20170820211022,             20170820210522,             20170820210022         ], If I use the following code  // create from string    jData := GetJSON(memo1.text);    // output as a flat string    s := jData.AsJSON;    //  output as nicely formatted JSON    s := jData.FormatJSON;    // cast as TJSONObject to make access easier    jObject := TJSONObject(jData);                                  s := jData.FindPath('timestamps_int.23[1]').AsString;    showmessage(s); This will get me what I want if I know the hour I want is 23... What I want to get though is to tell it something like this..  s := jData.FindPath('timestamps_int.[1][1]').AsString; Instead of telling it 23[1] I want to say grab the first hour in the object and grab the first element from that array.. Does that make sense? Is there a way to do that? ---------------------------------------------------------------------- molly · 2017-08-21 03:08 jArray := TJSONArray(jData.FindPath('timestamps_int')); and iterate the items, taking count into consideration. ---------------------------------------------------------------------- vonskie · 2017-08-21 03:29 Thank you! Thank You!  jArray := TJSONArray(jData.FindPath('timestamps_int'));  showmessage(jarray.Arrays[0].Strings[0]); Exactly what I was looking for ---------------------------------------------------------------------- molly · 2017-08-21 03:37 ah, yes.... that is also possible. I haven't even thought of that  just because we can (do it differently): Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure ProcessJSON(JSONDataString:String);var  jData:TJSONData;  jArray:TJSonArray;  i,j:Integer;begin  jData:=GetJSON(JSONDataString);  jArray:=TJSONArray(jData.FindPath('timestamps_int'));  for i:=0 to Pred(jArray.Count) do  begin    WriteLn;    Writeln('Number of items in this array = ',jArray.Items[i].Count);    for j:=0 to Pred(jArray.Items[i].Count) do    begin      WriteLn('Item[',i,'].[',j:2,'] = ',jArray.Items[i].Items[j].AsString);    end;  end;  WriteLn;  jData.Free;end;  But, yours is as just as good (that is if it works for you) ---------------------------------------------------------------------- vonskie · 2017-08-21 13:56 Thanks again!