diff --git a/modules/st2-auto-form/fields/array.js b/modules/st2-auto-form/fields/array.js index d77a088e5..110892342 100644 --- a/modules/st2-auto-form/fields/array.js +++ b/modules/st2-auto-form/fields/array.js @@ -21,7 +21,7 @@ const typeChecks = (type, value) => { case 'integer': return !validator.isInt(v) && `'${v}' is not an integer`; case 'object': - return !_.isPlainObject(v) && `'${v}' is not an object`; + return !_.isPlainObject(value) && `'${v}' is not an object`; case 'string': default: return false; @@ -79,6 +79,10 @@ export default class ArrayField extends BaseTextField { return v; } + if (Array.isArray(v) && this.props.spec.items.type === 'object') { + return JSON.stringify(v); + } + const { secret } = this.props.spec || {}; if (secret && v && !Array.isArray(v)) { return v;