Click here to Skip to main content
15,908,437 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
The JSON object looks like:

{"status":"OK","data":{"group_id":226369621,"0":{"id":"226369621-1","customid":"","customid1":"","customid2":"","mobile":"34684426702","status":"AWAITED-DLR","country":"ES"}},"message":"Campaign of 1 numbers Submitted successfully."}

What I have tried:

public string groupid(string resp)
{



var serializer = new JavaScriptSerializer();

var groupid = serializer.Deserialize<ids>(strResponse);



}
public class ids
{

public string group_id { get; set; }
public string status { get; set; }
}
Posted
Updated 17-Mar-16 23:54pm
Comments
Afzaal Ahmad Zeeshan 18-Mar-16 5:49am    
And what is the problem that you are facing?
F-ES Sitecore 18-Mar-16 6:21am    
Your code is very far from what you need to do. I suggest you start with the documentation, try the example code...don't just copy and paste it, but go through it and actually understand what it is doing

https://msdn.microsoft.com/en-us/library/system.web.script.serialization.javascriptserializer(v=vs.100).aspx

1 solution

According to your json, Please create a ResponseModel Generic Class something like below and Use Newtonsoft Json Library

C#
public class ResponseModel<T>
{
    public T data { get; set; }
    public string status { get; set; }
}


Then you can parse your json like below:

C#
JsonConvert.DeserializeObject<ids>(json_Holder)
 
Share this answer
 
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900