提交 44d00f87 编写于 作者: J Jb Evain

Add pretty print support for null values in JsonObjects

上级 b214e1e6
......@@ -141,7 +141,13 @@ namespace System.Json
stream.WriteByte ((byte) '"');
stream.WriteByte ((byte) ',');
stream.WriteByte ((byte) ' ');
pair.Value.Save (stream);
if (pair.Value == null) {
stream.WriteByte ((byte) 'n');
stream.WriteByte ((byte) 'u');
stream.WriteByte ((byte) 'l');
stream.WriteByte ((byte) 'l');
} else
pair.Value.Save (stream);
}
stream.WriteByte ((byte) '}');
}
......
......@@ -148,7 +148,10 @@ namespace System.Json
w.Write ('\"');
w.Write (EscapeString (pair.Key));
w.Write ("\": ");
pair.Value.SaveInternal (w);
if (pair.Value == null)
w.Write ("null");
else
pair.Value.SaveInternal (w);
following = true;
}
w.Write ('}');
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册