开发者

JSON Nullable Deserialization Error

开发者 https://www.devze.com 2023-03-07 02:20 出处:网络
Suppose you have a simple struct,开发者_如何学运维 like so: public struct Point { public int X { get; set; }

Suppose you have a simple struct,开发者_如何学运维 like so:

public struct Point
{
    public int X { get; set; }
    public int Y { get; set; }
}

And a sample class like so:

public class Map
{
    public int ID { get; set; }
    public Point? PointA { get; set; }
    ///...
}

Now, suppose you are passing Map via AJAX as JSON. Question, what value should be passed for the not null scenario?

It may matter that JavaScriptSerializer is being used in a C# 3.5 ASP.NET ASMX web service.


The issue is what I listed in my comment about the question. The automatic properties were the issue. I converted the property and the issue was resolved.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号