[solved, great solution] json reading - no idea where to start lazarus / 21-General ---------------------------------------------------------------------- Nicole · 2025-04-02 17:34 After a very productive time with ChatGPT, I tried to work with json. It talks me into complete nonsense since days. Nothing works. What I want looks quite easy to me. Never the less I never did it before. I grabbed a json file, which looks really nice, if I double-click it and view it in notepad ++ I attach it. And I have an array TKurse, which "looks the same": 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 Type TEineKontraktZeile = packed Record       Datum: TDateTime;     open, high, low, close, Volume: double;        end;Type TKurse  = array of TEineKontraktzeile;     So, it shall be easy to take the data from one and fill it in the other? However it does not work and does not work. As I worked never before with json, it starts with the basic question, if I have to transform it. ChatGPT said, I shall make it a string. I did by TstingList and stringList.saveAs made it a file. So there is the option to work with the json file or the saved stringList of it. Please hint me! The next riddle are the meta-data. Sure, we all can read and understand them. Is there a way that the computer reads them and know, what to do? What I need is a basic demo, how json works. ChatGPT made a lot of suggestions for source code and I ended up with compiler warnings "unknown..." something. So the basic demo shall hint me as well, what to write best into the uses clauses and may be a class or unit to work with best. thanks ---------------------------------------------------------------------- Nicole · 2025-04-02 17:35 attach ---------------------------------------------------------------------- cdbc · 2025-04-02 18:02 Hi Have you had a look in "C:\...?...\fpcsrc/packages/fcl-json/examples/" That's where you find the built-in FPC JSON classes and units: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 uses ..., fpjson; should put the lazarus editor on track, for a start... Regards Benny ---------------------------------------------------------------------- wp · 2025-04-02 18:06 There is also a wiki on json: https://wiki.freepascal.org/fcl-json And the article "Web data formats in Lazarus/FPC" by Michael Van Canneyt contains a chapter on json: https://www.freepascal.org/~michael/articles/webdata/webdata.pdf ---------------------------------------------------------------------- Renat.Su · 2025-04-02 19:14 I think this article is that you want https://wiki.lazarus.freepascal.org/Streaming_JSON But it is about class instances not record. ---------------------------------------------------------------------- wp · 2025-04-02 22:09 Here is a small demo reading your json file and displaying it in a stringgrid and a chart. Note that the analysis of the file is not generally valid here, it is tuned to your data file for simplicity. ---------------------------------------------------------------------- Nicole · 2025-04-03 09:31 Thank you so very much WP! This code does all, what I dreamed of!