Home Grab a single value from json response
Reply: 1

Grab a single value from json response

Kevin himch
Kevin himch Published in 2018-01-12 10:58:08Z

First check two screen shots. One is debug error one is for json data visual view to give you better understanding. My main goal is to grab only "campaignId" value form this json response. I already tried to use JObject parse but getting error because RestSharp output not json string format so. Now tell me how can i grab that "campaignId" value of json response. Thanks in advance.

static void addEmailToList(string ListName, string Email, string Name)
            var client = new RestClient("https://api.getresponse.com/v3/campaigns?query[name]="+ListName);
            var GetIdreq = new RestRequest(Method.GET);
            GetIdreq.AddHeader("X-Auth-Token", "api-key 948df-my-key-7f3c6");
            GetIdreq.AddParameter("application/json", ParameterType.RequestBody);

            var GetIdres = client.Execute(GetIdreq);

            dynamic data = JObject.Parse(GetIdres);

Nitesh Reply to 2018-01-12 12:30:54Z

You should assign the value of Content of response to your local variable. You can try this.

var GetIdres = client.Execute(GetIdreq).Content;
dynamic data = JObject.Parse(GetIdres);
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.303889 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO