我正在製作和Android應用程序中,我從API獲取JSON數據,但我不知道如何獲取JSON數據,我們傳遞序列化的getter和setter類。 這裏是我的JSON數據{"status":true,"message":"Notifications fetched.","data":[{"id":"69","type":"liked","text":"Sandip Ghosh liked your photo.","for_userid":"56","from_userid":"55","for_image":"54","seen":"0","username":"sandip","firstname":"Sandip","lastname":"Ghosh","imgname":""},{"id":"64","type":"liked","text":"Sandip Ghosh liked your photo.","for_userid":"56","from_userid":"55","for_image":"54","seen":"0","username":"sandip","firstname":"Sandip","lastname":"Ghosh","imgname":""},{"id":"63","type":"liked","text":"Sandip Ghosh liked your photo.","for_userid":"56","from_userid":"55","for_image":"54","seen":"0","username":"sandip","firstname":"Sandip","lastname":"Ghosh","imgname":""},{"id":"62","type":"commented","text":"Sandip Ghosh commented onyour photo.","for_userid":"56","from_userid":"55","for_image":"54","seen":"0","username":"sandip","firstname":"Sandip","lastname":"Ghosh","imgname":""},{"id":"61","type":"liked","text":"Sandip Ghosh liked your photo.","for_userid":"56","from_userid":"55","for_image":"53","seen":"0","username":"sandip","firstname":"Sandip","lastname":"Ghosh","imgname":""},{"id":"27","type":"Follow","text":"Sandip Ghosh started following you","for_userid":"56","from_userid":"55","for_image":"0","seen":"1","username":"sandip","firstname":"Sandip","lastname":"Ghosh","imgname":""}]}
如何獲取json in retrofit2
0
A
回答
0
把你的整個JSON來http://pojo.sodhanalibrary.com/ 這將創建模型本身爲您服務。 它會毫不費力地創建Serializable模型。 然後使用這些模型來獲取值。 欲瞭解更多關於以下教程: https://github.com/codepath/android_guides/wiki/Consuming-APIs-with-Retrofit
相關問題
- 1. Retrofit2 HTTP獲取Json到RecyclerView
- 2. 從json獲取ID recycleview retrofit2
- 3. Null Object In Retrofit2
- 4. 如何在Android Studio中使用retrofit2獲取json日誌?
- 5. 如何發佈JSON,但使用Retrofit2獲取XML響應?
- 6. 畸形的JSON Retrofit2
- 7. Retrofit2如何獲得重定向URL @HEAD( 「/」)
- 8. 從retrofit2
- 9. Retrofit2 - JSON數組解析
- 10. Retrofit2後JSON與字段名
- 11. Retrofit2後身體爲JSON
- 12. 如何從陣列獲取的數據在陣列retrofit2
- 13. 如何獲取動態JSON
- 14. 如何獲取此JSON
- 15. 如何retrofit2的Android
- 16. 如何從URL獲取JSON
- 17. 如何使用RxJava2等Retrofit2
- 18. 如何獲取Json在android
- 19. 如何獲取JSON數據
- 20. 如何獲取JSON路徑?
- 21. 如何從System.Windows.Browser.ScriptObject獲取JSON
- 22. 如何從json獲取值?
- 23. 如何獲取JSON值?
- 24. 如何獲取JSON對象
- 25. 如何從json獲取值
- 26. 如何獲取JSON值?
- 27. 如何獲取json變量?
- 28. 如何從JSON獲取DateTime
- 29. 如何在retrofit2 android中傳遞POST參數類型json,?
- 30. Retrofit2 SSLHandshakeException
小心發佈您的代碼? – Coder