Hi Ravi,
I tried,
my code:
namespace HttpClientSample
{
[DataContract]
public class Student
{
[DataMember]
public string Ssid { get; set; }
[DataMember]
public string Verbatim { get; set; }
[DataMember]
public string Category { get; set; }
[DataMember]
public string Sub_Category { get; set; }
}
/* public class Verbatim
{
public string Verb { get; set; }
}*/
class Program
{
static HttpClient client = new HttpClient();
string secretkey = string.Empty;
string userName = "admin";
string passWord = "admin";
static void Main(string[] args)
{
IOrganizationService service = GetOrganization();
Entity ensmart = new Entity("ics_smartfeedbacks");
string fetchxml = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>" +
" <entity name='ics_smartfeedbacks'>" +
" <attribute name='ics_smartfeedbacksid' />" +
" <attribute name='ics_name' />" +
" <attribute name='createdon' />" +
" <attribute name='new_verbatim' />" +
" <attribute name='ics_feedbackcodes' />" +
" <attribute name='ics_feedbacksubcode' />" +
" <attribute name='ics_ssid' />" +
" <order attribute='ics_name' descending='false' />" +
" <filter type='and'>" +
" <filter type='and'>" +
" <condition attribute='new_verbatim' operator='not-null' />" +
" <filter type='or'>" +
" <condition attribute='new_isverbatimupdated' operator='eq' value='0' />" +
" <condition attribute='new_isverbatimupdated' operator='null' />" +
" </filter>" +
" </filter>" +
" </filter>" +
" </entity>" +
"</fetch>";
using (MemoryStream SerializememoryStream = new MemoryStream())
{
//create a sample data of type Student Class add details
Student NewStudent = new Student();
NewStudent.Ssid = "Shahzeb";
NewStudent.Verbatim = "testing";
//initialize DataContractJsonSerializer object and pass Student class type to it
DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(Student));
//write newly created object(NewStudent) into memory stream
serializer.WriteObject(SerializememoryStream, NewStudent);
//use stream reader to read serialized data from memory stream
StreamReader sr = new StreamReader(SerializememoryStream);
Console.WriteLine(serializer);
//get JSON data serialized in string format in string variable
string Serializedresult = sr.ReadLine(); //i'm getting null here, its blank. is there any mistake.
}