How to get the keyname of TJsonData.Index (used with FindPath) lazarus / 21-General ---------------------------------------------------------------------- marque1968 · 2021-03-08 07:10 I have an issue which is probably easy to solve, but I am not seeing the solution... excerpt of the json file: 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 {  "screens": {    "main": {      "name": "BuildScreen",      "border": 0,      "popup": false,      "buttons": {        "num0": {          "caption": "0",          "displayposition": "center",        },      "info": {          "caption": "More|Info",          "displayposition": "center",        }      }    },   I want to iterate through my buttons. In my test-setup I created: 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  memo3.text := j.FindPath('screens.main.buttons').Items[iFieldNr].AsJSon; This gets me all the data needed, except of the ID of the buttons ("num0" and "info" respectively) I cannot find the way to retrieve this key. So my hope is on the community here. Hope any of you can help me out here. [Edited to add code tags - please see How to use The Forum.] ---------------------------------------------------------------------- avk · 2021-03-08 07:46 TJSONObject has property Names[Index : Integer] : TJSONStringType. This seems to be what you need. ---------------------------------------------------------------------- marque1968 · 2021-03-09 07:05 Thank you@avk, However it is TJSONdata and this does not have a names option: Code: [Select]procedure TForm1.Button4Click(Sender : TObject); begin   memo3.text := j.FindPath('screens.main.buttons').Items[1].AsJSon;   label1.caption := j.FindPath('screens.main.buttons').Names[1]; end; Findpath is also a TJSONdata type, which does contains the [bItems[/b], but not a Names. The above code therefore does not compile. Perhaps I am missing a way to convert it to TJsonObject? ---------------------------------------------------------------------- marque1968 · 2021-03-09 07:20 Thank you @avk, As a result of my last remark, I started searching, and found the solution to be rather easy (as long as you know it) Code: [Select]procedure TForm1.Button4Click(Sender : TObject); begin   memo3.text := j.FindPath('screens.main.buttons').Items[1].AsJSon;   label1.caption := TJSONobject(j.FindPath('screens.main.buttons')).Names[1]; end; This works. Thank you for steering me in the right direction. ---------------------------------------------------------------------- avk · 2021-03-09 18:11 You are welcome.