Skip to content

Instantly share code, notes, and snippets.

@kadmil
Created May 16, 2013 08:39
Show Gist options
  • Save kadmil/5590298 to your computer and use it in GitHub Desktop.
Save kadmil/5590298 to your computer and use it in GitHub Desktop.
Gist showing serialization issue.
[Route("/tmp")]
public class Tmp:IReturn<TmpResponse>
{
public string Param { get; set; }
}
public class TmpResponse
{
public Dictionary<KeyClass, List<ResponseData>> ResponseOptions { get; set; }
}
public class KeyClass
{
public string FirstString { get; set; }
public string SecondString { get; set; }
}
public class ResponseData
{
public string FirstProperty { get; set; }
public int SecondProperty { get; set; }
}
public class TmpService : Service
{
public object Get(Tmp request)
{
//return on client:
// {"{\"FirstString\":"first",\"SecondString\":"second"}":[{"FirstProperty":"first","SecondProperty":1}]}
//which is not deserializable to object due to quotes
return new Dictionary<KeyClass, List<ResponseData>>
{
{
new KeyClass() {FirstString = "first", SecondString = "second"},
new List<ResponseData>() {new ResponseData() {FirstProperty = "first", SecondProperty = 1}}
}
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment