Using strongly typed models

Strongly typed models are programmatic representations of the content types in your Kentico Cloud project. They help you map the content retrieved from the Delivery API (which comes in the form of JSON objects) directly to a model you can use in your code.

Table of contents

This practice has several advantages:

type safety during compile-time

convenience (IntelliSense remembers content type properties for you)

support of type-dependent functionalities (such as display templates in MVC)

Life without strongly typed models

When retrieving content directly from the API, you receive your content items as JSON objects. Your application then needs to parse the JSON to display your content.

For example, in TypeScript, you would access a Headline element of your content item like this: {~response.item.elements.headline.value.~} Here is an example of retrieving, parsing and displaying a small content item.

A complete example

What's next?

In practice, you often have to define how your application resolves Rich text elements containing assets, links, components, and other content items. This works a little differently for each platform, so we recommend that you have a look at the documentation of the SDK you are using: