我正在處理一個非常複雜的Windows 8應用程序的大型JSON數據。在.net中,我們可以綁定類以在解析JSON之後填充數據。但爲此,我們需要精確的JSON數據類。對我來說很難讓課堂正確。請幫助是否有任何簡單的程序爲Windows 8應用程序生成JSON數據綁定的類?
2
A
回答
3
類通過複製整個JSON數據串生成類 使用http://json2csharp.net。
然後
public async Task<string>getData()
{
HttpClient client=new HttpClient();
String URL="your string";//url for the JSON response
HttpResponseMessage response=await client.GetAsync(URL);
Return await response.Content.ReadAsStringAsync();
}
private void async Button1_click()
{
string responseText= await getData();
DataContractJsonSerializer= new DataContractJsonSerializer(typeOf(RootObject));//DataContractJsonSerializer is the class object that u will generate
RootObject root;
Using(MemoryStream stream=new MemoryStream(Encoding.Unicode.GetBytes(responseText)))
{
//access properties here
}
}
3
相關問題
- 1. 如何在Windows 8應用程序的數據綁定應用程序中添加json從數據綁定應用程序中的json
- 2. 是否有爲Windows Store應用程序生成映像的應用程序?
- 3. Android應用程序是否有任何菜單生成器?
- 4. 是否有任何應用程序爲XML生成XSL?
- 5. 爲簡單應用程序生成PHAR
- 6. 在Windows 8中生成地圖應用程序的URL 8
- 7. 是否有從PDF生成HTML表單的應用程序?
- 8. 是否有Java/Spring Web應用程序的表單生成器?
- 9. Windows 8應用程序 - 單擊按鈕時的簡單動畫?
- 10. 爲應用程序生成數據
- 11. 是否有任何Dynamics CRM 2011的Windows移動應用程序?
- 12. Windows 8應用程序數據
- 13. Windows 8應用程序在線數據
- 14. 簡單地綁定到WPF應用程序中的類
- 15. 使用列表框的Windows Phone 8應用程序中的數據綁定
- 16. Windows應用商店的應用程序 - 動態數據綁定
- 17. 使用json數據在windows 8 metro風格的應用程序中的數據綁定(c#)
- 18. 是否可以創建沒有任何主題的簡單應用程序?
- 19. 使用JSON和.NET的簡單數據收集應用程序
- 20. Windows Phone 8應用程序 - Facebook集成
- 21. 的Windows 8/RT + Phone 8個的應用程序 - 同步數據
- 22. 在Windows Phone 8應用程序中讀取JSON URL數據
- 23. Windows 8 HTML/JavaScript Metro應用程序中的雙向綁定
- 24. 是否有任何Windows命令來卸載應用程序?
- 25. 是否有可能捕獲由Python應用程序生成的任何回溯?
- 26. Windows Store應用程序/ Metro應用程序:ListView數據綁定錯誤
- 27. 的Windows Metro風格應用程序的數據綁定
- 28. 爲Windows 8解析XML數據的Web服務應用程序
- 29. 是否有任何symfony2 tutorail爲複雜的web應用程序
- 30. Windows 8 WPF應用程序
感謝網址和使用JSON對象的代碼 – Harshit
快樂希望我幫助 – Apoorv