Contentful logo

Contentful Community

Unwrap nested references

I am attempting to unwrap content that contains a list of categories, which contains a list of topics. The categories are unwrapped correctly, but the topics are empty. I have verified the field ids match and the data is present in the raw json. Is there another step that must be performed to transform the inner nested elements?

@ContentfulEntryModel("troubleshooting")
data class ContentfulTroubleshooter (
    @ContentfulField
    var categories: List<ContentfulCategory> = emptyList()
)

@ContentfulEntryModel("category")
data class ContentfulCategory (
    @ContentfulField("category_id")
    var id: Double? = 0.0,
    @ContentfulField("category_name")
    var name: String = "",
    @ContentfulField
    var topics: List<ContentfulTopic> = emptyList()
)

@ContentfulEntryModel("topic")
data class ContentfulTopic (
    @ContentfulField(value = "topicId")
    var id: Double? = 0.0,
    @ContentfulField("topic_name")
    var name: String = ""
)

Thanks