Open Flithor opened 1 year ago
My current implementation:
public class JsonWriterEx
{
static void WriteIndent(this JsonWriter jw)
{
typeof(JsonWriter).GetMethod("WriteIndent", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).Invoke(jw, null);
}
}
I'm try to write some custom comment by custom
JsonConverter
for some members.But i cannot find a direct way to write indent width of current level.
And
WriteComment
not have a "start with newline and indent" override.Expected output
Expected behavior
Make
WriteIndent
public or makeWriteComment
have a override can output in newline with indent.Actual behavior
WriteIndent
is protected, andWriteComment
only append text only, cannot write a indented comment of current indent level directly.Related issue: https://github.com/JamesNK/Newtonsoft.Json/issues/2334