Presented samples are indented for clarity, but the default behavior is to write the resulting JSON string without extra spaces. You can override this behavior as follows:
jw.Formatting = Formatting.Indented; jw.WriteStartObject(); ...
additional literature
So that each entry is added to a new line, you can simply write a new line character after you have written your JSON object, for example:
... jw.WriteEndObject(); jw.WriteRaw("\n");
Or by calling WriteLine in the underlying TextWriter , although this needs to be done outside of this method.
source share