How to serialize only dictionary's values into json (using json.net) [duplicate]

倾然丶 夕夏残阳落幕 提交于 2019-12-11 15:27:51

问题


what is easiest way to serialize dictionary as list of its values into json using Json.NET?

Serialization is done by SignalR, not me. So I need some attribute-like way or custom contract resolver or something like that.

Dictionary is better for me on the server side but for the binding into data grid on the client, flatten object would be better.

Thanks


回答1:


Are you looking for something like that;

JsonConvert.SerializeObject(dictionary.Values.ToList());


来源:https://stackoverflow.com/questions/47887954/how-to-serialize-only-dictionarys-values-into-json-using-json-net

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