json from a json-newbie lazarus / 21-General ---------------------------------------------------------------------- Nicole · 2025-05-03 11:30 I am very new in json. There is a working function looking similar to 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 TAktienkurse_holen.vonPrep_HistoryAlsJson(Ticker: string; abDatum:TDate=0): TJSONData;   const* my keys * var HttpClient: TFPHTTPClient;  // Europäische Daten gibt es nur mit "ultimo"    JsonResponse: TJSONData;    // Abo und das kostet 99 im Monat    URL: string;    Response: string;    datum: TDate; begin  result:=nil;  HttpClient := TFPHTTPClient.Create(nil);  // The program uses TFPHTTPClient to send a GET request  URL:= Base_Url +  'historical- price-full/' + Ticker + API_KEY;     // die Umstellung der Zuweisungen führte dazu, dass es nicht mehr funktionierte  Response := HttpClient.Get(URL);    // Send GET request to fetch stock quote  JsonResponse := GetJSON(Response);  // The GetJSON function parses the JSON response.  Result := JsonResponse;  // diese Kombination funktioniert, die "Vereinfachung" nicht!  HttpClient.Free; end; This takes the data from one url and writes all of them to my database. Unfortunately it only has US data. If anybody needs it,   BASE_URL = 'https://financialmodelingprep.com/api/v3/'; works fine. Back to my topic. I need European stocks as well and I asked Alpha Vantage for it. In "response" are exactly the data I want to have. Unfortunately the result of the function is empty. The data are lost in the 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 JsonResponse := GetJSON(Response); As my whole logic is built on the work-on with json ad this code- interface and converting it to my own format and writing it in loops to my database, - I would prefer to fix this very line. Otherwise I can start again. How do I write this very line differently? Why does it work with the other service and not here? ---------------------------------------------------------------------- TRon · 2025-05-03 11:46 Quote from: Nicole on May 03, 2025, 01:30:40 pmHow do I write this very line differently? You don't. At least not without parsing the json yourself which is not advisable to do because that is the whole purpose of the getjson function. QuoteWhy does it work with the other service and not here? You tell us :-) Write out the response string in order to see what the actual returned string contains. That way it is possible to check if a valid json result was returned. Also the error handling could be improved. Use a try finally block after creation of httpclient so that every http related action can be 'checked'.