Skip to main content
Including constructor inside C# code
Source Link
Rick Wolff
  • 775
  • 12
  • 31

As @Alex has said in the comments:

As far as reading it goes, anything contained inside [ ] is considered an array. So the "items" field is an array containing arrays

If you don't want to have this array of arrays, you can create a new class to encapsulate the inner array. For instance:

{
  "items":
    [
      { "numbers": [24,68,216,34006,32224] },
      { "numbers": [68,177,277,140,2130] }, 
      |...skip big amount of data....| ,
      { "numbers": [79606,8500392,0,0,14]],
    ],
  "updated": 1475686082000,
  "columns": [ "id", "buy", "sell", "supply", "demand"]
}

And your classes in C# would be:

public class Parent
{
  public List<Child> items;
  public int updated;
  public string[] columns; 

  public Parent()
  {
    items = new List<Child>();
  }
}

public class Child
{
  public string[] numbers;
}

Something like that.

As @Alex has said in the comments:

As far as reading it goes, anything contained inside [ ] is considered an array. So the "items" field is an array containing arrays

If you don't want to have this array of arrays, you can create a new class to encapsulate the inner array. For instance:

{
  "items":
    [
      { "numbers": [24,68,216,34006,32224] },
      { "numbers": [68,177,277,140,2130] }, 
      |...skip big amount of data....| ,
      { "numbers": [79606,8500392,0,0,14]],
    ],
  "updated": 1475686082000,
  "columns": [ "id", "buy", "sell", "supply", "demand"]
}

And your classes in C# would be:

public class Parent
{
  public List<Child> items;
  public int updated;
  public string[] columns;
}

public class Child
{
  public string[] numbers;
}

Something like that.

As @Alex has said in the comments:

As far as reading it goes, anything contained inside [ ] is considered an array. So the "items" field is an array containing arrays

If you don't want to have this array of arrays, you can create a new class to encapsulate the inner array. For instance:

{
  "items":
    [
      { "numbers": [24,68,216,34006,32224] },
      { "numbers": [68,177,277,140,2130] }, 
      |...skip big amount of data....| ,
      { "numbers": [79606,8500392,0,0,14]],
    ],
  "updated": 1475686082000,
  "columns": [ "id", "buy", "sell", "supply", "demand"]
}

And your classes in C# would be:

public class Parent
{
  public List<Child> items;
  public int updated;
  public string[] columns; 

  public Parent()
  {
    items = new List<Child>();
  }
}

public class Child
{
  public string[] numbers;
}

Something like that.

Source Link
Rick Wolff
  • 775
  • 12
  • 31

As @Alex has said in the comments:

As far as reading it goes, anything contained inside [ ] is considered an array. So the "items" field is an array containing arrays

If you don't want to have this array of arrays, you can create a new class to encapsulate the inner array. For instance:

{
  "items":
    [
      { "numbers": [24,68,216,34006,32224] },
      { "numbers": [68,177,277,140,2130] }, 
      |...skip big amount of data....| ,
      { "numbers": [79606,8500392,0,0,14]],
    ],
  "updated": 1475686082000,
  "columns": [ "id", "buy", "sell", "supply", "demand"]
}

And your classes in C# would be:

public class Parent
{
  public List<Child> items;
  public int updated;
  public string[] columns;
}

public class Child
{
  public string[] numbers;
}

Something like that.