Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 46379

How do I parse OData response?

$
0
0

Hi all

I have this data response:

"{
"d" : {
"results": [
{
"__metadata": {
"uri": "http://win-bd86268lvbk/CRMDEVELOPMENT/XRMServices/2011/OrganizationData.svc/BusinessUnitSet(guid'69e04798-1576-e611-80e4-308d99276d29')", "type": "Microsoft.Crm.Sdk.Data.Services.BusinessUnit"
}, "Address1_StateOrProvince": "Sindh", "Address1_Line1": "Gulshan e Iqbal", "Address1_City": "Karachi", "BusinessUnitId": "69e04798-15768d99276d29", "Address1_PostalCode": "75300", "Address1_Country": "Pakistan"
}
]
}
}"

How do parse it using JavaScript.?

 I tried these options but fail to get values:

var retrieved = JSON.parse(req.responseText).d,
retrievedRecord = retrieved.results.Address1_Line1,
City = retrieved.results[0].Address1_City,
Country = retrieved.results[1].Address1_Country;

Only the highlighted one is working which gives me the above response.

Thank You


Viewing all articles
Browse latest Browse all 46379

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>