c# – How can one feed such a value in C #?


How to feed such a value: {"reg":"date","univer":"","name":""} ?

 request.AddParam("listing" , "{"reg":"date","univer":"","name":""}");

I tried with slashes but it didn’t work, please help me solve this problem …


Of course, I'm not against writing the Json object manually, but I am for serialization in order to avoid all sorts of errors, so something like this:

using Newtonsoft.Json;

public class RequestListingModel
    public DateTime Reg {get;set;}
    public string Univer {get;set;}
    public string Name {get;set;}

var jString = JsonConvert.SerializeObject(new RequestListingModel{
    Reg = DateTime.Now,
    Univer = "МГУ",
    Name = "Петя Иванов"
request.AddParam("listing" , jString);
Scroll to Top