I am trying to parse a JSON string into a C# class. however i can't get it to work.
the JSON looks like this
{
reports:
{
report:
{
id:"1"
step:
{
id:"2"
step:
[
{
id:"3"
step:
[
{
id:"4"
},
{
id:"5"
}
]
},
{
id:"6"
step:
{
id:"7"
}
}
]
}
}
}
}
i made a few classes to define the structure.
private class report
{
public mongoReports reports;
}
private class mongoReports
{
public mongoReport report;
}
private class mongoReport
{
public string id;
public step step;
}
private class step
{
public string id = "";
}
private class step
{
public string id = "";
public step step;
}
private class step
{
public string id = "";
public list<step> step;
}
the problem is in the 3 definitions that step can have. 1 without and step property, 1 with step being of type 'step' 1 with step being a list of objects of type 'step'.
how can I make a proper 'step' class that fits all these structures?