I am using REST API to for getting data from SharePoint.
I have one list like category with three column Title
and two lookup name like childcategory
, parentcategory
.
I have some data in which there is no value in both lookup child and parent category.
now I fire query to fetch data expanding lookup value with its Title and ID.
so I'm getting data but in some data of lookup where I didn't get any key value for expanded title and ID
Response I get like below :
"ChildCategory":{"__deferred":{"uri":"https://xyz.sharepoint.com/sites/abc/_api/Web/Lists(guid'156456416')/Items(6)/ChildCategory"}}
and in some row have data in lookup that data in response look like this:
"SubCategory":{"__deferred":{"uri":"https://xyz.sharepoint.com/sites/abc/_api/Web/Lists(guid'156456416')/Items(8)/SubCategory"},
Title:"abc",
ID:10}
so now how can I parse this json.??
because if I am trying to get Value using Key like Title. so it give JSONException because in some data it don't have that key like first which I have posted response.
How to solve this problem?
Any help greatly appreciated.