1

I want to deserialize a JSON array using Newtonsoft to class.

The JSON array like (Api returns that)

[1,"1",true,2,3]

To class

class MyObject {
    public int Number { get; set; }
    public string Data { get; set; }
    public bool IsIt { get; set; }
}

Is there any way except creating the constructor like

public MyObject(object[] array) {
    Number = (int)array[0];
    Data = (string)array[1];
    IsIt = (bool)array[2];
}
PsiHamster
  • 255
  • 2
  • 11

0 Answers0