-1

{ "data": { "id": 204, "username": "R_SHAKTISINH", "email": "", "mobile_no": "9924141516", "fullName": "SHAKTISINH", "middleName": null, "lastName": "RANA", "gender": "male", "birthday": "07/11/2019", "address": "Rajkot", "profileImage": "uploads/profile/user.png", "child": [ { "id": 138, "studentRollId": "", "admission_number": "40", "account_active": 1, "fullName": "Rana Rajnandnibaa Shaktisinh", "username": "r_rajnandnibaa", "email": "", "isLeaderBoard": "", "mobile": "F: 9913362628 M: 99241 41516 ", "studentClass": "Kindergarten-1", "studentSection": "Kindergarten-1", "student_image": "uploads/profile/user.png" } ] }, "status": 1, "message": "Success" }

shivambhanvadia
  • 487
  • 4
  • 7
  • Does this answer your question? [how-to-parse-json-in-kotlin](https://stackoverflow.com/questions/41928803/how-to-parse-json-in-kotlin) – Tushar Moradiya Feb 11 '20 at 09:53

1 Answers1

0

create this class:

    data class DataModel (
    val data: Data,
    val status: Long,
    val message: String
)

data class Data (
    val id: Long,
    val username: String,
    val email: String,
    val mobileNo: String,
    val fullName: String,
    val middleName: Any? = null,
    val lastName: String,
    val gender: String,
    val birthday: String,
    val address: String,
    val profileImage: String,
    val child: List<Child>
)

data class Child (
    val id: Long,
    val studentRollID: String,
    val admissionNumber: String,
    val accountActive: Long,
    val fullName: String,
    val username: String,
    val email: String,
    val isLeaderBoard: String,
    val mobile: String,
    val studentClass: String,
    val studentSection: String,
    val studentImage: String
)

now you. can use Gson to parse it.

https://mkyong.com/java/how-to-parse-json-with-gson/

SinaMN75
  • 6,742
  • 5
  • 28
  • 56