il mio servizio web restituisce i dati json come indicato di seguito ma volevo è come in 2nd CodeSnipts. il mio servizio web e classe come indicato di seguito.Conversione in formato Json Risposta da webservice
{ "ShowID": 10107,
"StartTime": "3:00 PM",
"MovieID": 13,
"Movie": "Bhaag Milkha Bhaag ",
"Screen": "CDC SCreen2",
"MediaPath": "bmb1_568962.jpg"
},{ "ShowID": 115,
"StartTime": "6:00 PM",
"MovieID": 13,
"Movie": "Bhaag Milkha Bhaag ",
"Screen": "CDC SCreen2",
"MediaPath": "bmb1_568962.jpg"
},{ "ShowID": 110,
"StartTime": "9:00 PM",
"MovieID": 13,
"Movie": "Bhaag Milkha Bhaag ",
"Screen": "CDC SCreen2",
"MediaPath": "bmb1_568962.jpg"
}
ma voglio come
{
"MovieID": 13,
"Movie": "Bhaag Milkha Bhaag ",
"Screen": "CDC SCreen2",
"MediaPath": "bmb1_568962.jpg",
"ShowInfo": [
{
"ShowID": 10107,
"StartTime": "3:00 PM"
},
{
"ShowID": 115,
"StartTime": "6:00 PM"
},
{
"ShowID": 110,
"StartTime": "9:00 PM"
}
]
}
il mio codice C# per Webservice come elenco
[WebMethod]
public string NowShowingGetList(DateTime ShowDate)
{
HomeController obj = new HomeController();
JavaScriptSerializer js = new JavaScriptSerializer();
string retJSON = js.Serialize(obj.NowShowingGetList(ShowDate));
return retJSON;
}
classe come
public class NowShowingInfo
{
public int ShowID { get; set; }
public string StartTime { get; set; }
public int MovieID { get; set; }
public string Movie { get; set; }
public string Screen { get; set; }
public string MediaPath { get; set; }
}
qui obj.NowShowingGetList(ShowDate)
ritorno Grazie in anticipo.
È necessario creare una nuova nome della classe ShowInfo e annuncio d Array o List of it in NowShowingInfo. La classe ShowInfo conterrà nome proprietà: ShowId e StartTime –
È necessario creare un nuovo nome di classe ShowInfo e aggiungere Array o Elenco di esso in NowShowingInfo. La classe ShowInfo con – manoj