web_core's FormatStringImplementation (renderers/web_core/src/v0_9/basic_catalog/functions/basic_functions.ts) uses Array.prototype.join(''), which falls back to JS's default String(value) for object/array values. This contradicts a2ui_protocol.md §"Type conversion":
Objects/Arrays: Stringified as JSON to ensure consistency across different client implementations.
Related but distinct from #912, which only standardized scalar (null/undefined/Number/Boolean) coercion.
Reproduction
Given a data model:
{
"tags": ["swift", "ios"],
"user": { "name": "Alice", "age": 30 },
"matrix": [[1, 2], [3, 4]],
"vals": [1, null, 3]
}
| Template |
Spec says |
web_core actually outputs |
"Tags: ${/tags}" |
Tags: ["swift","ios"] |
Tags: swift,ios |
"User: ${/user}" |
User: {"name":"Alice","age":30} |
User: [object Object] |
"M = ${/matrix}" |
M = [[1,2],[3,4]] |
M = 1,2,3,4 (nested arrays flattened) |
"V = ${/vals}" |
V = [1,null,3] |
V = 1,,3 (null silently dropped) |
The object case is the most damaging: any object value renders as the literal string [object Object], which is essentially data loss.
Impact
Affects web_core and every renderer that re-exports BASIC_FUNCTIONS from it (react, lit, angular).
web_core'sFormatStringImplementation(renderers/web_core/src/v0_9/basic_catalog/functions/basic_functions.ts) usesArray.prototype.join(''), which falls back to JS's defaultString(value)for object/array values. This contradictsa2ui_protocol.md§"Type conversion":Related but distinct from #912, which only standardized scalar (
null/undefined/Number/Boolean) coercion.Reproduction
Given a data model:
{ "tags": ["swift", "ios"], "user": { "name": "Alice", "age": 30 }, "matrix": [[1, 2], [3, 4]], "vals": [1, null, 3] }"Tags: ${/tags}"Tags: ["swift","ios"]Tags: swift,ios"User: ${/user}"User: {"name":"Alice","age":30}User: [object Object]"M = ${/matrix}"M = [[1,2],[3,4]]M = 1,2,3,4(nested arrays flattened)"V = ${/vals}"V = [1,null,3]V = 1,,3(null silently dropped)The object case is the most damaging: any object value renders as the literal string
[object Object], which is essentially data loss.Impact
Affects
web_coreand every renderer that re-exportsBASIC_FUNCTIONSfrom it (react,lit,angular).