Json.Net: JsonSerializer-Attribute for custom naming [duplicate]

雨燕双飞 提交于 2019-12-17 16:15:34

问题


I use the JsonSerializer from Newtonsoft.

But i want to name the json-objects by myself.

I tried the JsonObject attribute

[JsonObject(Description = "MyName", Title = "orThisname")]

JsonArray also didnt work... Is it possible to name the json-objetcs/arrays by myself?


回答1:


I think I found the solution:

[JsonProperty(PropertyName = "Myname")]

will rename it.



来源:https://stackoverflow.com/questions/6860602/json-net-jsonserializer-attribute-for-custom-naming

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!