首页 > 编程语言 >C#对象转json

C#对象转json

时间:2022-10-28 17:48:39浏览次数:53  
标签:City C# 对象 json appointmentErpStoreEntity Provider null

 

object obj = new
                    {
                        Provider = appointmentErpStoreEntity.ProvinceName,
                        City = appointmentErpStoreEntity.CityName,
                        District = appointmentErpStoreEntity.CountyName,
                        Address = appointmentErpStoreEntity.Address
                    };
                    addressInfo = JsonConvert.SerializeObject(obj);

如果赋值为null,一样可以转换成json,

变成:{“Provider”:null,”City”:null........}

标签:City,C#,对象,json,appointmentErpStoreEntity,Provider,null
From: https://www.cnblogs.com/jankie1122/p/11108703.html

相关文章