zesty.io

Product

Use Cases

Integrations

Learn

Headless & Hybrid toJSON

When using both Headless and Hybrid WebEngine Modes, an additional JSON method becomes available: toJSON.

To aid in the consumption of content the toJSON endpoint is available in both Headless and Hybrid WebEngine Modes. The endpoint will render an object containing a content item's meta, stored and related data when /?toJSON is applied to the end of the established URL routing of the item.

For example: https://www.mydomain.com/blog/my-article/?toJSON

The URL routing utilizes the established route configured for the content items view. It can be added to live or preview branch URLs. However, when accessing the content for production using the live branch is the best practice to ensure that only live published content is rendered.

Content Output

The content item's fields and their contents will render in key-value pairs. Related content obtained through One-to-One or One-to-Many fields will render as a sub-object with a corresponding data array. The data array will include hydrated objects of the related items. For example, below the coauthor field is a One-to-One relational with the selected items data object.

toJSON object with One-to-One relational JSON output

toJSON-render

The content hydration level of the returned object has a default depth of three. The top-level is the first and two lower depth levels of related content. The hydration depth cannot be set via URL.

No Meta Option

The meta data provided in the object may not be necessary when consuming the content. These can be removed before the object is returned by adding a nometa query parameter value to the end of your URL.

For example: https://www.mydomain.com/blog/my-article/?toJSON=nometa

This will remove the meta data from the primary content item's rendering and the related items' objects as well.

Start Here

We will listen to your needs and walk you through how Zesty can help your team.

Connect with Content Experts

Book a free 15-minute consultation with a content expert. Discuss your application, pain points and requirements. Understand how Zesty's lower total cost of ownership, features, functionality can elevate your business by creating extraordinary digital experiences.

Trusted By

zesty customer logo Sonyzesty customer logo Rocket Leaguezesty customer logo Singlifezesty customer logo Acornszesty customer logo Phoenix Sunszesty customer logo Wattpadzesty customer logo Corner Shopzesty customer logo Bjs

Enter your details to connect with a Content Expert

First Name

Last Name

Email

Phone (optional)

Company

Please tell us about your project (optional)

G2 MOMENTUM LEADER

zesty customer logo zesty customer logo zesty customer logo zesty customer logo