Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

We can not make model for objects of objects #438

Open
DarshanKBhattt opened this issue Oct 8, 2024 · 0 comments
Open

We can not make model for objects of objects #438

DarshanKBhattt opened this issue Oct 8, 2024 · 0 comments

Comments

@DarshanKBhattt
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant