ich nutze Newtonsoft.Json um den content der customfields aus folgendem Object zu ermitteln:
total "2"
issues
0
id "1"
fields
customfield_1 "one"
customfield_2
value: "one"
id: "1"
1
id "2"
fields
customfield_1 "two"
customfield_2
value: "two"
id: "2"
Es fehlt jedoch eine Möglichkeit verschachtelte Schlüssel auf Existenz abzufragen. Z.B. so
Object.ContainsKey("total"));
if (jObject["issues"] != null)
{
foreach (JToken issue in jObject["issues"])
{
if (issue["fields"] != null)
{
foreach (string customfield in myCustomfields)
{
if (issue["fields"][customfield] != null)
{
if (issue["fields"][customfield]["id"] != null)
{
//get content
}
if (issue["fields"][customfield]["value"] != null)
{
//get content
}
}
}
}
}
}
Bliebe noch die Möglichkeit mit String Operationen drauf los zugehen ... weiß jemand, ob es auch eleganter funktioniert?
Danke Euch