当属性的值在 json 字符串中设置为 undefined 时会发生什么。IE:
{"Name":undefined}
以下示例使用 json.net 库。反序列化对象时抛出异常。
JsonConvert.DeserializeObject<SimpleObject>("{\"Name\":undefined}");
public class SimpleObject
{
public string Name { get; set; }
}
Newtonsoft.Json.JsonReaderException was unhandled
Message=Error reading string. Unexpected token: Undefined. Path 'Value', line 1, position 18.
Source=Newtonsoft.Json
LineNumber=1
LinePosition=18
Path=Value