Reputation: 1344
I have a JSON Object returned from server.
{
"SOAP-ENV:Envelope": {
"SOAP-ENV:Body": {
"ADDWEBSOperationResponse": {
"Num1": 10,
"Result": 20,
"Num2": 10,
"xmlns": "http://www.**.**.Response.com"
}
},
"xmlns:SOAP-ENV": "http://schemas.xmlsoap.org/soap/envelope/",
"xmlns:soapenv": "http://schemas.xmlsoap.org/soap/envelope/",
"xmlns:add": "http://www.**.**.Request.com"
}
}
I wanted to print Result
in my page. I was trying with data.Result
but its not displaying the value.
Upvotes: 2
Views: 245
Reputation: 822
data["SOAP-ENV:Envelope"]["SOAP-ENV:Body"]["ADDWEBSOperationResponse"].Result
Upvotes: 1
Reputation: 281626
I should be
data["SOAP-ENV:Envelope"]["SOAP-ENV:Body"]["ADDWEBSOperationResponse"].Result
You need to follow the hierarchy.
Upvotes: 1
Reputation: 9974
Use bracket notation
as it is particularly useful for non-identifier-safe characters and also for accessing keys that you may not know ahead of time
data["SOAP-ENV:Envelope"]["SOAP-ENV:Body"]["ADDWEBSOperationResponse"]["Result"]
Upvotes: 4
Reputation: 35338
Try it with
data['SOAP-ENV:Envelope']['SOAP-ENV:Body']['ADDWEBSOperationResponse'].Result
Upvotes: 3