基本上,我从我的 azure ws 输出中收到这样的输出:
{
'Results': {
'WSOutput': {
'type': 'table',
'value': {
'ColumnNames': ['ID', 'Start', 'Ask', 'Not', 'Passed', 'Suggest'],
'ColumnTypes': ['Int32', 'Int32', 'Int32', 'Double', 'Int64', 'Int32'],
'Values': [['13256025', '25000', '19000', '0.35', '1', '25000']]
}
}
}
}
如您所见,该字符串包含创建数据表对象的信息。现在,我似乎找不到一种简单的方法将其转换为实际的数据表 POCO。我可以使用 Newtonsoft.Json.Linq 手动编写解析器,但必须有一种更简单的方法。
有人知道怎么做吗?我似乎在网上找不到任何东西。
最佳答案
是的,网上有一个开源在线生成器( http://jsonutils.com/ )。复制粘贴您的结果将为您提供:
public class Value
{
public IList<string> ColumnNames { get; set; }
public IList<string> ColumnTypes { get; set; }
public IList<IList<string>> Values { get; set; }
}
public class WSOutput
{
public string type { get; set; }
public Value value { get; set; }
}
public class Results
{
public WSOutput WSOutput { get; set; }
}
public class Example
{
public Results Results { get; set; }
}
关于c# - 将数据表字符串从 Azure ML WS 转换为实际的数据表 C# 对象?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49056593/