.. _developer-cobjects: =================== TypoScript cObjects =================== EXT:headless registers a handful of new cObjects: * `JSON` * `CONTENT_JSON` * `BOOL`, `FLOAT`, `INT` `BOOL`, `FLOAT` and `INT` take `value` and `value.` (stdWrap applied to the value); every remaining top-level property is treated as stdWrap configuration directly — `noIndex.field = no_index` works, there is no `stdWrap.` sub-key like core `TEXT`. They return a real bool / float / int and only work as fields *inside* a `JSON` cObject, not in generic TypoScript. JSON ==== Builds a JSON object inline. .. code-block:: typoscript lib.meta = JSON lib.meta { if.isTrue = 1 fields { title = TEXT title { field = seo_title stdWrap.ifEmpty.cObject = TEXT stdWrap.ifEmpty.cObject { field = title } } robots { fields { noIndex = BOOL noIndex.field = no_index } } ogImage = TEXT ogImage { dataProcessing { 10 = FriendsOfTYPO3\Headless\DataProcessing\FilesProcessor 10 { as = media references.fieldName = og_image processingConfiguration { returnFlattenObject = 1 } } } } } dataProcessing { } stdWrap { } } The JSON cObject understands these properties: **`if`** — render the object only when the condition is met. **`fields`** — array of child cObjects. Each field accepts: * `intval` / `floatval` / `boolval` — cast the result. * `ifEmptyReturnNull` — return `null` when the result is empty. * `ifEmptyUnsetKey` — drop the key when the result is empty. * `source` — nested field blocks only: output the block's `fields` result under a different key. Ignored on plain fields, and ignored when the block defines `dataProcessing` — that result is always stored under the block's own key. * `dataProcessing` — run data processors (see `lib.meta.ogImage`). **`nullableFieldsIfEmpty`** — comma list of field names to null out when empty (bulk variant of `ifEmptyReturnNull`). A field whose cObject is `USER_INT` (or whose output starts with an `