Cannot deserialize the current JSON array (e.g. [1,2,3]) into type ‘model’ because the type requires a JSON object (e.g. {“name”:“value”}) to deserialize correctly.
错误:
Cannot deserialize the current JSON array (e.g. [1,2,3]) into type ‘model’ because the type requires a JSON object (e.g. {“name”:“value”}) to deserialize correctly. To fix this error either change the JSON to a JSON object
原因:
json或xml字符串中有与预设的model结构不匹配的结构出现,需要仔细对比字符串和目标model预设的结构
例如如下图中NEXT在model中定义为Property,但xml中出现NEXT为collection,造成反序列化识别报错
解决:
如修改Model侧,应该定义NEXT为collection
或修改xml源避免出现NEXT节点重复