【优化】cfg 导出json格式数据时,object类型不再导出值为null的属性

main
walon 2021-08-14 12:51:15 +08:00
parent 6003ec95f0
commit ef6524626e
1 changed files with 3 additions and 2 deletions

View File

@ -111,14 +111,15 @@ namespace Luban.Job.Cfg.DataExporters
continue; continue;
} }
x.WritePropertyName(defField.Name);
// 特殊处理 bean 多态类型 // 特殊处理 bean 多态类型
// 另外,不生成 xxx:null 这样
if (d == null || (d is DBean db && db.ImplType == null)) if (d == null || (d is DBean db && db.ImplType == null))
{ {
x.WriteNullValue(); //x.WriteNullValue();
} }
else else
{ {
x.WritePropertyName(defField.Name);
d.Apply(this, ass, x); d.Apply(this, ass, x);
} }
} }