Vijay Anand inquired about this particular matter yesterday, unfortunately, the discussion was closed before receiving any solutions:
HTTP Response:
{
"entry": {
"@xml:base": "https://API_PROC_SRV/",
"@xmlns": "http://www.w3.org/2005/Atom",
"@xmlns:m": "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata",
"@xmlns:d": "http://schemas.microsoft.com/ado/2007/08/dataservices",
"id": "https://API_PROC_SRV/A_Order",
"title": {
"@type": "text",
"#text": "A_Order()"
},
"updated": "2020-02-29T07:33:28Z",
"category": {
"@term": "Type",
"@scheme": "http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"
},
"link": [],
"content": {
"@type": "application/xml",
"m:properties": {
"d:Order": "123456789"
}
}
}
}
Javascript code:
var json = response;
var order = json.object.entry.content['m:properties']['d:Order']; // Attempting to retrieve Order details from the above response.
Error (for example, jsbin.com):
"TypeError: Cannot read property 'entry' of undefined
at null.js:27:25
at https://static.jsbin.com/js/prod/runner-4.1.7.min.js:1:13924
at https://static.jsbin.com/js/prod/runner-4.1.7.min.js:1:10866"
According to JSLint, the JSON response is valid.
json.object.entry
appears to be incorrect ... however
Q: What is the correct syntax in Javascript to access the value of "order" (referred to as d:Order
), particularly when both m:properties
and d:Order
contain colons in their names?
PS: I have suggested Vijay's original enquiry for reopening ... although chances seem slim. Hence, my new question.