When I make an Ajax POST request, the response I receive is structured like this:
{
"columns": [
"r"
],
"data": [
[
{
"extensions": {},
"start": "http://localhost:7474/db/data/node/2762",
"property": "http://localhost:7474/db/data/relationship/2709/properties/{key}",
"self": "http://localhost:7474/db/data/relationship/2709",
"properties": "http://localhost:7474/db/data/relationship/2709/properties",
"type": "IS_CONNECTED_WITH",
"end": "http://localhost:7474/db/data/node/2763",
"metadata": {
"id": 2709,
"type": "IS_CONNECTED_WITH"
},
"data": {
"FOC_Type": "IRU",
"DuctType": "IRU",
"TrenchType": "IRU",
"linestringId": "53805"
}
}
]
]
}
The response above appears as a string. My goal is to access specific elements within it such as "FOC_Type":"IRU"
,"DuctType":"IRU"
,"TrenchType":"IRU"
,"linestringId":"53805"
.
My attempt involves converting the string to JSON using the following code:
var response = JSON.parse(response);
I then try to extract values in this way:
var dataEquip = response[Object.keys(response)[Object.keys(response).length - 1]];
var komvosName = dataEquip[0][2];
Despite my efforts, I have not been successful in making it work.
I have resorted to a workaround where I manipulate the string directly without converting it to JSON format. However, this solution is not ideal. If anyone can provide guidance on what I might be doing wrong, I would greatly appreciate it.