나는 C#에서 JSON.NET을 사용하여 Klout API의 응답을 구문 분석한다. 내 응답은 다음과 같습니다.C#에서 JSON 객체 반복하기
[
{
"id": "5241585099662481339",
"displayName": "Music",
"name": "music",
"slug": "music",
"imageUrl": "http://kcdn3.klout.com/static/images/music-1333561300502.png"
},
{
"id": "6953585193220490118",
"displayName": "Celebrities",
"name": "celebrities",
"slug": "celebrities",
"imageUrl": "http://kcdn3.klout.com/static/images/topics/celebrities_b32741b6703151cc7bd85fba24c44c52.png"
},
{
"id": "5757029936226020304",
"displayName": "Entertainment",
"name": "entertainment",
"slug": "entertainment",
"imageUrl": "http://kcdn3.klout.com/static/images/topics/Entertainment_7002e5d2316e85a2ff004fafa017ff44.png"
},
{
"id": "3718",
"displayName": "Saturday Night Live",
"name": "saturday night live",
"slug": "saturday-night-live",
"imageUrl": "http://kcdn3.klout.com/static/images/icons/generic-topic.png"
},
{
"id": "8113008320053776960",
"displayName": "Hollywood",
"name": "hollywood",
"slug": "hollywood",
"imageUrl": "http://kcdn3.klout.com/static/images/topics/hollywood_9eccd1f7f83f067cb9aa2b491cd461f3.png"
}
]
위의 내용과 마찬가지로 5 id
태그가 포함되어 있습니다. 아마도 다음에 6이나 1 또는 다른 숫자가 될 것입니다. JSON을 반복하고 각 id
태그의 값을 얻고 싶습니다. 내가 얼마나 많이 있을지 모른 채 루프를 돌릴 수는 없다. 이 문제를 어떻게 해결할 수 있습니까?
이 Micrsofot.CSHARp 및 System.Core.I both.It의 APS.NET 앱 –
에 추가 참조에 빠진 참조가 불행하게도 '동적'키워드는 이후 프레임 워크 4.0 :( –