开发者

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

开发者 https://www.devze.com 2023-03-23 19:09 出处:网络
This question already has answers here: How can I change property names when serializing with Json.net?
This question already has answers here: How can I change property names when serializing with Json.net? 开发者_运维知识库 (4 answers) Closed 7 years ago.

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?


I think I found the solution:

[JsonProperty(PropertyName = "Myname")]

will rename it.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号