Skip to content

We can not make model for objects of objects #438

@DarshanKBhattt

Description

@DarshanKBhattt

I have below response. I know this is bad but sometimes we need to use this as requirements. With current update this extension can not make model for this but I have solution as when we have this type of response we do like this and Implement it if possible

@Keep
@JsonClass(generateAdapter = true)
data class test(
  @Json(name = "test")
    val name: Map<String, testModel>
    )
    
    @Keep
@JsonClass(generateAdapter = true)
data class testModel(
 @Json(name = "amenities")
    val amenities: List<Amenity?>?,
    @Json(name = "bathroom")
    val bathroom: Int?, // 3
    @Json(name = "bedroom")
    val bedroom: Int?, // 4
    )
here we have used object name as key and object as model class so Please update it if possible. Don't take name as it is just demo 
{
    "status": "success",
    "status_code": 200,
    "data": {
                {
                    "id": 1,
                    "name": "Swimming Pool",
                    "amenity_image": "http://192.168.1.118:8000/media/amenities/icons8-swimming-100.ico"
                },
                {
                    "id": 2,
                    "name": "Car Parking",
                    "amenity_image": "http://192.168.1.118:8000/media/amenities/car_parking.ico"
                }
        },
        "dynamic_details": {
                {
                    "id": 1,
                    "name": "Swimming Pool",
                    "svg_path": ""
                },
                {
                    "id": 2,
                    "name": "Car Parking",
                    "svg_path": ""
                },
                {
                    "id": 3,
                    "name": "Helicopter Parking",
                    "svg_path": ""
                },
                {
                    "id": 4,
                    "name": "Garden",
                    "svg_path": ""
                },
                {
                    "id": 5,
                    "name": "Cricket",
                    "svg_path": ""
                },
                {
                    "id": 6,
                    "name": "Football Ground",
                    "svg_path": ""
                },
                {
                    "id": 13,
                    "name": "Spa",
                    "svg_path": ""
                },
                {
                    "id": 14,
                    "name": "Near Green Zone",
                    "svg_path": ""
                },
                {
                    "id": 15,
                    "name": "Internet",
                    "svg_path": ""
                },
                {
                    "id": 17,
                    "name": "movie theatre",
                    "svg_path": ""
                },
                {
                    "id": 18,
                    "name": "Yoga classrrom",
                    "svg_path": ""
                },
                {
                    "id": 19,
                    "name": "Cafes and coffee shops",
                    "svg_path": ""
                },
                {
                    "id": 20,
                    "name": "Pet areas like dog",
                    "svg_path": ""
                },
                {
                    "id": 21,
                    "name": "Vehicles charging area",
                    "svg_path": ""
                },
                {
                    "id": 22,
                    "name": "Lift",
                    "svg_path": ""
                }
             
            }
        }
    },
    "errors": "",
    "message": "Property Details Fetched"
}

Actually I'm newbie so I don't know code as well as coding terms so If you don't understand anything read it with perspective of newbie.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions