Target filter
Search Kotlin docs
  • Platforms
  • Tealium Prism Kotlin
core/com.tealium.prism.core.api.misc/TemplateProcessor/process

process

fun process(template: String, context: DataObject): String

Processes the input template looking for all occurrences of double brace wrapped text: {{ }}

The format of text inside the braces can be as follows:

  • a valid json path style string: e.g. {{container.key}}

  • a valid json path style string with an optional fallback: e.g. {{container.key || fallback}}

    • in the event that container.key is not available in the context object, the fallback will be used

All occurrences of the templating {{ }} will be replaced with either the value from the context object according to the json path specified, or the fallback string if provided, else a blank string ""

This method is lenient, meaning that invalid JsonPath strings will be ignored, and a fallback or empty string will be resolved instead.

Regarding the formatting of different data types.

  • String, Integer, Long, Boolean all follow their toString implementation

  • Doubles will be in a human readable format; non-scientific, and trimmed decimal places

  • DataItem.NULL or missing values will resolve as empty strings ""

  • DataObject and DataList will be formatted as JSON, and thus nested values follow standard JSON formatting (i.e. scientific notation is allowed as well as nulls)

Return

A new string with all substitution blocks replaced

Parameters

template

the String to process for {{ }} substitution block

context

the DataObject to extract values from

Generated by Dokka
(c) Tealium 2026