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;
My answer is now not relevant, since the code sample in the question has been edited to include these lines, left here for posterity, see comments for more info.
You will need to add the following to close the JSON elements properly:
Then call the StringBuilder's ToString() method:
string strMyString = sw.ToString();