Need help json and tmdb lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- HengeDK · 2023-04-18 12:29 Need help I can't figure out why this dosen't work and I get access violation at this line 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 WriteLn('Title: ', Results.Items[i].FindPath('original_name').AsString); see attachment for json output from tmdb 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 function TFileScanner.SearchMovies(query: string): TJSONArray;var  HTTPClient: TFPHTTPClient;  Response: string;  JSONData: TJSONData;  Results: TJSONArray;begin  HTTPClient := TFPHTTPClient.Create(nil);  try     Response := HTTPClient.Get('https://api.themoviedb.org/3/search/tv?api _key=xxxxxxx&query=' + EncodeUrl(query));  finally    HTTPClient.Free;  end;   JSONData := GetJSON(Response);  try    Results := JSONData.FindPath('results') as TJSONArray;  finally    JSONData.Free;  end;   //Result := Results;  WriteLn(Results.ToString);end; 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   try    for i := 0 to Results.Count - 1 do    begin      WriteLn('Title: ', Results.Items[i].FindPath('original_name').AsString);      WriteLn('ID: ', Results.Items[i].FindPath('id').AsString);      WriteLn('Overview: ', Results.Items[i].FindPath('overview').AsString);      WriteLn;    end;  finally    Results.Free;  end; ---------------------------------------------------------------------- avk · 2023-04-18 17:41 In the FpJson implementation, a JSON document is a rooted tree, where each element is responsible for freeing the memory occupied by its children. Respectively, by calling Free() for the root element (JSONData.Free, line 20) you thus destroy the entire document, including the Results element. ---------------------------------------------------------------------- HengeDK · 2023-04-19 09:16 Thanks