2012-05-24 6 views
0

웹 사이트에서 json 파일을 읽는 Windows Phone 애플리케이션을 만들려고합니다. 이 json 파일에 반복 그룹이있어 프로그램을 모든 그룹을 읽을 수없는 것으로 보입니다.json, 그룹 반복 읽기

{ 
    "program":{ 
     "title":"Carl Schmitz", 
     "image_url":"http:\/\/q-music.be\/sites\/2009.q-music.be\/files\/NOA.jpg" 
    }, 
    "noa":[ 
     { 
      "title":"Behind Blue Eyes", 
      "artist":"LIMP BIZKIT", 
      "itunes_link":"http:\/\/clk.tradedoubler.com\/click?p=24379&a=1256924?url=http:\/\/itunes.apple.com\/be\/album\/behind-blue-eyes\/id14915153?i=14915155&uo=4&partnerId=2003" 
     }, 
     { 
      "title":"Alone Again", 
      "artist":"ALYSSA REID", 
      "itunes_link":"http:\/\/clk.tradedoubler.com\/click?p=24379&a=1256924?url=http:\/\/itunes.apple.com\/be\/album\/alone-again-original-mix\/id496520410?i=496520415&uo=4&partnerId=2003" 
     } 
    ] 
} 

사람이 어떻게 JSON을 읽는 나를 설명 할 수 :

이것은 json으로 출력의 예입니다?

답변

1

클래스 구조는 다음과 같아야합니다. 나는 그걸 생성하기 위해 awhome json2csharp을 사용했습니다 :

그러면 RootObject로 직접 deserialize 할 수 있어야합니다. 사용중인 serializer에 대해서는 언급하지 않았으므로 실제 deserialization은 여기에 표시되지 않습니다 (아직).

public class Program 
{ 
    public string title { get; set; } 
    public string image_url { get; set; } 
} 

public class Noa 
{ 
    public string title { get; set; } 
    public string artist { get; set; } 
    public string itunes_link { get; set; } 
} 

public class RootObject 
{ 
    public Program program { get; set; } 
    public List<Noa> noa { get; set; } 
} 
+0

고맙습니다. – Jerodev