我ProcessStartInfo
JSON.NET序列化的ProcessStartInfo
ProcessStartInfo psi = new ProcessStartInfo()
{
FileName = "path",
Arguments = "args",
UseShellExecute = false,
RedirectStandardError = true,
CreateNoWindow = true,
Verb = "runas"
};
类的对象和记录的目的我想它序列化到JSON。 我的代码:
string json = JsonConvert.SerializeObject(psi);
json
包含:
“System.Diagnostics.ProcessStartInfo”
如何序列化属性这一翻译键入的名字吗?
这是因为'ProcessStartInfo'上的[TypeConverter(typeof(ExpandableObjectConverter))]'属性。看看例如[Newtonsoft json序列化程序返回空对象](http://stackoverflow.com/questions/11044639/newtonsoft-json-serializer-returns-empty-object)。 – CodeCaster
@CodeCaster谢谢。我需要在一个地方。自己的ContractResolver是太多的工作;-)在这个JSON.NET中没有切换? – BWA