简体   繁体   中英

How to get data from this type of JSON response using retrofit in Android

This is JSON response:

    {
        "0": {
            "userId": "8888888888",
            "Long": "77.28717",
            "Lat": "28.63864",
            "time": "14:14:47",
            "date": "2020-12-19"
        },
        "1": {
            "userId": "8888888888",
            "Long": "77.28141",
            "Lat": "28.63602",
            "time": "14:10:05",
            "date": "2020-12-19"
        },
        "2": {
            "userId": "8888888888",
            "Long": "77.28716",
            "Lat": "28.63863",
            "time": "14:09:40",
            "date": "2020-12-19"
        },
        "status": "success"
    }

Retrofit

This can help you. You have to try.

here is a link for create pojo class for retrofit response. create here your class.

  1. paste your response here and select other option you want like serializable, parcalble etc.
  2. then give your package name and class name.
  3. then download zip from there and add to your project.

here is example for your class.

这是您班级的示例。

Here is full example for calling API through retrofit.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM