From normal values to Json Parameters:
using
(MemoryStream ms = new MemoryStream())
{
DataContractJsonSerializer
serializer = new
DataContractJsonSerializer(objuser1.GetType());
serializer.WriteObject(ms,
objuser1);
ms.Position = 0;
using
(StreamReader reader = new StreamReader(ms))
{
string
JsonString= reader.ReadToEnd();
Label11.Text =
JsonString;
}
}
From Json parameters to normal parameters:
string
url = Server.MapPath("~/App_Data/JsonResult.txt");
System.IO.StreamReader myFile = new
System.IO.StreamReader(url);
string myString = myFile.ReadToEnd();
myFile.Close();
Stream stream =
new
MemoryStream(Encoding.Unicode.GetBytes(myString.ToString()));
User1 objuser =
new User1();
DataContractJsonSerializer objSerializer = new
DataContractJsonSerializer(typeof(User1));
objuser =
(User1)objSerializer.ReadObject(stream);
public
class
User1
{
public string
UserName { get; set;
}
public string
FOUnit { get; set;
}
public string
CashLimit { get; set;
}
public string
TotalCollected { get;
set; }
public string TotalRemitted
{ get; set; }
}