Winform DataGridView - 绑定/使用JSON Webservice? [英] Winform DataGridView - Bind/Consume JSON Webservice?
问题描述
webservice可以输出xml或json,而xml没有问题,但我觉得json会提供更快的回复。
非常感谢任何帮助!
您可以创建一个类来模拟json结构,然后使用javascript序列化程序将json响应转换为可绑定列表
var myList = new JavaScriptSerializer()。反序列化< IList< MyClass>>(json);
这谷歌搜索给你一些关于如何使用反序列化json对象的完整示例JavaScriptSerializer 类
I have a winform application that contains a datagridview that I would like to populate using a JSON webservice. I am not having much luck finding any examples on the web, is this possible?
The webservice can output xml or json and the xml is no problem but I feel that the json would provide a quicker response.
Any help is greatly appreciated!
You can create a class to mimic the json structure and then use the javascript serializer to convert json response to a bindable list
var myList = new JavaScriptSerializer().Deserialize<IList<MyClass>>(json);
This google search gives you some complete examples about how to deserialize a json object using the JavaScriptSerializer class
这篇关于Winform DataGridView - 绑定/使用JSON Webservice?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!