Search code examples
c#jsonasmx

asmx JSON deserializer is not deserializing list


the title has all of it. I have an asmx service which is receiving a request with Content-Type: application/json and I'm having it deserialize directly to a POCO.

Everything is deserializing properly except for a single list property. This list is of another POCO, but I've also attempted to have it deserialize just strings and it still won't deserialize.

public class InputInfo {
  public String prop1  { get; set; }
  public String prop2  { get; set; }
  public String prop3  { get; set; }
  public String prop4  { get; set; }
  public String prop5  { get; set; }
  public String prop6  { get; set; }
  public Guid prop7    { get; set; }
  public String prop8  { get; set; }

  Public List<String> prop9             { get; set; }
  Public List<InputInfoSubclass> prop10 { get; set; }
}

InputInfoSubclassis just a simple POCO with 2 public string properties (name/email).

Both prop9 and prop10 don't deserialize at all and are null.

Any insight into how I get the deserialization to be recursive?

It turns out I didn't set the properties as public.... it's late.


Solution

  • looking at your code, they seem to be private. Try making them public