_json field
The _json field in Optimizely Graph provides the complete raw content payload for a content item, including nested structures, in a single GraphQL query.
NoteThe
_jsonfield is locked behind a feature flag. If the field does not display in your GraphQL schema, contact your system administrator to enable it.
The _json field returns the complete raw content payload for a content item in a single GraphQL query. Use this field when you want full access to all available data, including nested structures, without manually listing each field.
What the _json field provides
_json field providesWhen you request _json, Optimizely Graph returns the entire serialized content item as a JSON object.
The _json output includes:
- All content properties and values.
- Nested data (content areas, blocks, media, and references).
- Standard metadata fields such as Name, Key, Language, and ContentLink.
Retrieve a complete content item
query GetStartPage {
StartPage {
item {
Name
_json
}
}
}Response (simplified):
{
"data": {
"StartPage": {
"item": {
"Name": "Home Page",
"_json": {
"Name": "Home Page",
"Heading": "Welcome",
"MainBody": "Welcome to our website",
"Created": "2023-01-01T00:00:00Z",
"Status": "Published",
"Language": {
"DisplayName": "English",
"Name": "en"
},
"ContentLink": {
"Id": 1,
"GuidValue": "11111111-1111-1111-1111-111111111111",
"Url": "/home"
},
"__typename": "StartPage"
}
}
}
}
}You can combine _json with specific fields when you need both structured values and the full object.
Supported use cases
You can use _json in the following locations:
Use _json on the item field
_json on the item fieldUse _json inside an item query to return the full content item.
query GetStartPage {
StartPage {
item {
Name
_json # Returns the complete content item
}
}
}Use _json inside expanded references
_json inside expanded referencesUse _json inside Expanded to return fully resolved block or nested content data.
query GetPageWithBlocks {
StartPage {
item {
Name
MainContentArea {
Tag
ContentLink {
Expanded {
Name
_json # Full nested block data
}
}
}
}
}
}Use _json with filters, sorting, or search
_json with filters, sorting, or searchYou can use _json inside item even when the query includes filters, sorting, or facets.
query FilteredContent {
Content(
where: { Name: { contains: "product" } }
orderBy: { _score: DESC }
limit: 5
) {
items {
item {
Name
_json # Full item data
}
}
}
}Unsupported use cases
Optimizely Graph does not support the _json field directly under items in collection queries.
# Not supported
query Invalid {
Content {
items {
_json # This causes an error
}
}
}To retrieve full data for each item, use item { _json }:
# Supported alternative
query GetAllContent {
Content {
items {
item {
_json
}
}
}
}Advanced use cases of _json
_jsonDynamic content rendering
Use _json when you want to build presentation layers that adapt to any content structure.
query GetContent {
Content {
item {
Name
ContentType
_json # Retrieve all fields for dynamic rendering
}
}
}Retrieve nested content
Use _json inside expanded references to return complete block content.
query GetPageWithBlocks {
StartPage {
item {
Name
MainContentArea {
Tag
ContentLink {
Expanded {
Name
_json # Full details for each block in the content area
}
}
}
_json
}
}
}Performance considerations
The _json field returns more data than typical field-based queries. To optimize performance:
- Use
_jsononly when you need most or all fields for a content item. - Avoid using
_jsonin large list queries (not supported on items). - Combine
item { specificField _json }if you need both explicit fields and the full payload.
Security and data protection
The _json field only returns data your API key has permission to access. Optimizely Graph does not include sensitive system metadata. This includes:
- User permissions
- Role assignments
- Internal security attributes
Updated about 2 hours ago
