Note that there are some explanatory texts on larger screens.

plurals
  1. PONested json deserialized incompletely
    text
    copied!<p>I mentioned in title that the json is deserialized incompletely because some of the objects have the right value in the controller (I send the json to an asp.net mvc 4 controller), but the problem occurs with properties of objects stored in arrays (to be exact, the problem appears with Data)</p> <p>I have the following classes: </p> <pre><code>public class Node { [JsonProperty("id")] public int? Id { get; set; } [JsonProperty("name")] public string Name { get; set; } [JsonProperty("type")] public string Type { get; set; } private Data _data = new Data(); [JsonProperty("data")] public Data Data { get; set; } private List&lt;Adjacency&gt; _adjacencies = new List&lt;Adjacency&gt;(); [JsonProperty("adjacencies")] public List&lt;Adjacency&gt; Adjacencies { get { return _adjacencies; } set { _adjacencies = value; } } private List&lt;Instance&gt; _dependendStates = new List&lt;Instance&gt;(); public List&lt;Instance&gt; DependentStates { get { return _dependendStates; } set { _dependendStates = value; } } } public class Data { [JsonProperty("$posX")] public decimal PosX { get; set; } [JsonProperty("$posY")] public decimal PosY { get; set; } } public class Adjacency { [JsonProperty(PropertyName = "nodeTo")] public string NodeTo { get; set; } [JsonProperty(PropertyName = "data")] public AdjData Data { get; set; } //doesn't contain definition for automated transitions } public class AdjData { [JsonProperty(PropertyName = "$labelid")] public string LabelId { get; set; } [JsonProperty(PropertyName = "$labeltext")] public string Label { get; set; } [JsonProperty(PropertyName = "$type")] public string Type { get; set; } } </code></pre> <p>I've highlighted fields that don't have the right value. </p> <p><a href="http://img19.imageshack.us/img19/530/36976913.png" rel="nofollow noreferrer">The null problem http://img19.imageshack.us/img19/530/36976913.png</a></p> <p>The json looks like this: </p> <pre><code>{ "result":[ { "id":"100", "name":"Start", "data":{ "$posX":-100, "$posY":-100, "$deployed":true, "$color":"#000000", "$selected":"true" }, "adjacencies":[ { "nodeTo":"188", "data":{ "$type":"labeled_arrow", "$labelid":"Label Name", "$labeltext":"Label Name" } } ] }, { "id":"188", "name":"Second ", "data":{ "$dim":20, "$color":"#000000", "$selected":"true" }, "adjacencies":[ ] } ], "smName":"gftrds" } </code></pre> <p>I'm having a problem sorting this out as I do not understand or see where the problem is. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload