0

Looks like this should have been fairly easy task, but I'm kinda stuck.

Basically I am using a web service which returns JSON. In a debugger if I do something like

data.d

I am getting following JSON object.

{
   "d":[
      {
         "__metadata":{
            "uri":"http://service.cloud.net/FooService.svc/ZooInfoes(1)",
            "type":"Fun.Sun"
         },
         "Status":2,
         "GoingFishing":false
      }
   ]
}

However,

data.d[0]

just returns "{" and

data.d.Status 

returns "undefined"

Could someone help me to access Status or uri values?

premsh
  • 213
  • 3
  • 6
  • 16

1 Answers1

2

If data.d gives you {"d": ...}, then you want data.d.d[0].Status, or if you have a string, JSON.parse(data.d).d[0].Status

Eric
  • 95,302
  • 53
  • 242
  • 374
  • `data.d.d[0].Status` is not returning anything but `JSON.parse(data.d).d[0].Status` is giving perfect result! Thank you! – premsh Jun 18 '13 at 18:11