Customize identation parameter in JsonConvert.SerializeObject
问题 The default ident in Json.Net seems to be 2 spaces: var result = JsonConvert.SerializeObject(jsonString, Formatting.Indented); For clarity I want to change it to 4 spaces, but I don't seem to find the right way to apply the property. It seems that it exists, since I have found some similar code (direct link here): using (JsonTextWriter jw = new JsonTextWriter(sw)) { jw.Formatting = Formatting.Indented; jw.IndentChar = ' '; jw.Indentation = 4; jw.WriteRaw(config.ToString()); } ...except that,