{"action" : "check domain","status" : "success", "message":[{"awiv.com":"unavaliable"},{"index.com":"unavaliable"},{"hu0336.com":"available"},{"huzenglu.com":"available"}]}问题一:
我想取上面指定域名后面的unavaliable和available怎么获取啊?问题二:
如何把上面的json转换成datatable啊?
我想取上面指定域名后面的unavaliable和available怎么获取啊?问题二:
如何把上面的json转换成datatable啊?
2,使用c#的第三方json库来解析;或者.NET库里有提供一个可以模拟JS的类,也可以试试
3,自己分析
报错,错误提示:
Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.List`1[App.Mod.Domain]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.
To fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List<T>) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.
Path 'action', line 1, position 11.按你的写的
List<Domain> listData = JsonConvert.DeserializeObject<List<Domain>>(zz) ;//这里报错
dataGridView2.DataSource = listData;