Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion packages/base/src/UI5Element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@ const defaultConverter = {
if (type === Number) {
return value === null ? undefined : parseFloat(value);
}

if (type === Object || type === Array) {
try {
return JSON.parse(value as string) as object | Array<unknown>;
} catch {
return value;
}
}
return value;
},
toAttribute(value: unknown, type: unknown) {
Expand All @@ -88,7 +96,7 @@ const defaultConverter = {

// don't set attributes for arrays and objects
if (type === Object || type === Array) {
return null;
return JSON.stringify(value);
}

// object, array, other
Expand Down
2 changes: 1 addition & 1 deletion packages/base/src/UI5ElementMetadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class UI5ElementMetadata {
*/
hasAttribute(propName: string): boolean {
const propData = this.getProperties()[propName];
return propData.type !== Object && propData.type !== Array && !propData.noAttribute;
return propData.type !== Object && !propData.noAttribute;
}

/**
Expand Down
Loading
Loading