将以下4个例子放进表格数据操作模块,或者用表达式 JsonConvert.DeserializeObject<DataTable>({json文本})

例1例2直接报错,但是例3例4不报错直接输出了奇怪的结果。
1.Unexpected JSON token when reading DataTable: StartObject
(----临时动作:表格数据操作----)[ { "Row": 0, "Col": 3, "Association": { "MatchProcess": null } }, { "Row": 0, "Col": 0, "Association": null }]
2.Unexpected end when reading JSON.
(----临时动作:表格数据操作----)
[ { "Row": 0, "Col": 0, "Association": null }, { "Row": 0, "Col": 3, "Association": { "MatchProcess": null } }]
3.
[ { "Row": 0, "Col": 0, "Association": null }, { "Row": 0, "Col": 3, "Association": { "MatchProcess": null } }, { "Row": 1, "Col": 3, "Association": { "MatchProcess": null } }]

4.[ { "Row": 0, "Col": 0, "Association": null }, { "Row": 0, "Col": 3, "Association": { "MatchProcess": null } }, { "Row": 1, "Col": 3, "Association": null }, { "Row": 2, "Col": 3, "Association": { "MatchProcess": null } }]


ai这么解释“问题出在 "Association" 字段是一个嵌套对象,而 DataTable 期望的是扁平结构(即所有字段都是简单的值,而不是对象或数组)。在这种情况下,DataTable 无法直接解析嵌套对象。”
大概是 {}对象达到2个时,这个模块或者表达式就无法正常解析、报错,所以胡乱输出。

类似报错有"Children":[] , 试一下包含[] 的例子:
[
{
"Row": 0,
"Col": 0,
"Children": null,
"Association": null
},
{
"Row": 0,
"Col": 3,
"Children": [],
"Association": {
"MatchProcess": null,
"IsImageProcessor": false
}
},
{
"Row": 1,
"Col": 3,
"Children": [],
"Association": {
"MatchProcess": null,
"IsImageProcessor": false
}
}
]
发现2个小问题:
1.模块输出的表格json再次加载(比如动作状态)时 数字、布尔值类型有些情况下不正确,可能是 先有"Row":null 这个字段被判断为字符串类型。
2.DateTime格式如果先有"ShareTimeUtc": null ,后面的日期格式会变“2025/04/01 周二 06:08:33”

类型不正确的情况:
[
{
"AutoUpdate": false
},
{
"Row":1,
"AutoUpdate": false
}
]
加载:[{"Row":0,"AutoUpdate":null},{"Row":1,"AutoUpdate":false}]
输出:[{"Row":0,"AutoUpdate":null},{"Row":1,"AutoUpdate":"False"}]
加载:[{"AutoUpdate":false,"Row":null},{"AutoUpdate":false,"Row":1}]
输出:[{"AutoUpdate":false,"Row":null},{"AutoUpdate":false,"Row":"1"}]
类型正确的情况:
[
{
"Row":1,
"AutoUpdate": false
},
{
"AutoUpdate": false
}
]
加载:[{"Row":1,"AutoUpdate":false},{"Row":null,"AutoUpdate":false}]
输出:[{"Row":1,"AutoUpdate":false},{"Row":null,"AutoUpdate":false}]
先有"ShareTimeUtc": null ,后面的日期格式会变:
[
{
"Row":0,
"ShareTimeUtc": null
},
{
"Row":1,
"AutoUpdate": false,
"ShareTimeUtc":"2025-04-01T06:08:33.2573041Z"
}
]
[{"Row":0,"ShareTimeUtc":null,"AutoUpdate":null},{"Row":1,"ShareTimeUtc":"2025/04/01 周二 06:08:33","AutoUpdate":false}]
日期格式变化不大:
[
{
"Row":0,
"ShareTimeUtc": "2025-04-01T06:08:33.2573041Z"
},
{
"Row":1,
"AutoUpdate": false,
"ShareTimeUtc": null
}
]
[{"Row":0,"ShareTimeUtc":"2025-04-01T06:08:33.2573041","AutoUpdate":null},{"Row":1,"ShareTimeUtc":null,"AutoUpdate":false}]
