I am writing a json using Newtonsoft.json.JsonTextWriter. Here is my code:
StringBuilder sb = new StringBuilder();
StringWriter sw = new StringWriter(sb);
JsonWriter jsonWriter = new JsonTextWriter(sw);
jsonWriter.Formatting = Formatting.Indented;
jsonWriter.WritePropertyName("Name");
jsonWriter.WriteValue("Allan");
And i am assuming that sw
has the json format {"Name": "Allan"}. How can i get the written text in some string variable so that i can use this json data in my http request?