Parsing JSON file problem lazarus / 21-General ---------------------------------------------------------------------- BSaidus · 2023-11-13 10:46 Hello. I use a json file to save the application configuration, now I decided to modify its structure to meet my needs. Here is it. Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i {  "uc_system": {    "host": "uc1",    "domain": "uccenos.net",    "Ip": "127.0.0.1",    "Port": "7443",    "fwlang": "0",    "theme": "0"  }, "uc_aliases": {    "comments": "range mean the place order in display",    "count": 3,    "Items": [        { "range": 1, "name": "Http SRVR", "value": "172.16.110.21", "cmnts": "Http server on windows" },        { "range": 3, "name": "Dns SRVR",  "value": "172.16.110.20", "cmnts": "Dns server on windows"  },        { "range": 2, "name": "Mail SRVR", "value": "172.16.110.25", "cmnts": "Mail server on windows" }    ]  }}  Initially it was not like above but : Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i {  "uc_system": {    "host": "uc1",    "domain": "uccenos.net",    "Ip": "127.0.0.1",    "Port": "7443",    "fwlang": "0",    "theme": "0"  }, "uc_aliases": {    "comments": "range mean the place order in display",    "count": 3,    "aliases": {       "0": { "range": 1, "name": "Http SRVR", "value": "172.16.110.21", "cmnts": "Http server on windows" },       "1": { "range": 3, "name": "Dns SRVR",  "value": "172.16.110.20", "cmnts": "Dns server on windows"  },       "2": { "range": 2, "name": "Mail SRVR", "value": "172.16.110.25", "cmnts": "Mail server on windows" }    }  }} So, I use the 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 TJsonConfig object to access & manipulate file with 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 GetValue, SetValue. But when changed the structure, I can not access values from the "Items" clause. I tried 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   with TJSONConfig.Create(Nil) do  begin    Filename := 'gsystem.json';    //Formatted := true;    try      mmo1.Append('Rule0 (0)  : ' + String( GetValue('/uc_aliases/Items(0)/value'  , 'tcpXXX') ) );       mmo1.Append('Rule0 (1)  : ' + String( GetValue('/uc_aliases/Items/[0]/value' , 'tcpXXX') ) );      mmo1.Append('Rule0 (2)  : ' + String( GetValue('/uc_aliases/Items/0/value'   , 'tcpXXX') ) );      mmo1.Append('Rule0 (3)  : ' + String( GetValue('/uc_aliases/Items[0]/value'  , 'tcpXXX') ) );      mmo1.Append('Rule0 (4)  : ' + String( GetValue('/uc_aliases/Items[0]/[2]'    , 'tcpXXX') ) );      mmo1.Append('Rule0 (5)  : ' + String( GetValue('/uc_aliases/Items[0][2]'     , 'tcpXXX') ) );    finally    Free;    end;  end;   But nothing. Do I miss something?? Please HLP. Thank you. ---------------------------------------------------------------------- avk · 2023-11-13 13:49 If the problem was JSON parsing, the app would crash with an exception on line 3. IIRC, TJSONConfig does not support any path delimiters other than slashes. Therefore, all elements on the search path (except possibly the last one) must be objects.