prasanna p

prasanna p

  • 1.3k
  • 470
  • 103.4k

Getting cannot access child key error from the Web API

Sep 20 2020 1:23 AM
Hi friends,
 
I am getting response content from the Web API using Jobject
Jobject obj=JObject.Parse(responsecontent); but always I am getting the following error.
 
cannot access child key value on newtonsoft.json.linq.jvalue
 
My Json Sample :
 
{
"jsonrpc": "2.0",
"id": null, "result": "{\"status\": \"success\", \"res\": [{\"Rollnumber\": \"1581\", \"Receipt Time\": \"13:38:32\"},{\"Rollnumber\": \"1582\", \"Receipt Time\": \"15:10:32\"}]}}
 
I tried with Jobjects and Jtokens I am getting the result in the object but I am unable get the child object res\ token object values to insert this data into the sql server datatable.
 
I tried with res keyword and using stringbuilder I am concatinating \ to res i.e res\ keyword.
 
 
I tried different ways  but always getting the cannot access child key value on newtonsoft.json.linq.jvalue error.
 
Please tell me how to get the res object and using loop I need to insert res object values in the sql server datatable. 
 
 
 

Answers (4)