diff --git a/plugins/system/fields/fields.php b/plugins/system/fields/fields.php index 5d68764ffed7a..4409cc1209c83 100644 --- a/plugins/system/fields/fields.php +++ b/plugins/system/fields/fields.php @@ -90,6 +90,12 @@ public function onContentAfterSave($context, $item, $isNew, $data = array()) // Determine the value if it is available from the data $value = key_exists($field->name, $fieldsData) ? $fieldsData[$field->name] : null; + // JSON encode value for complex fields + if (is_array($value) && count($value, COUNT_NORMAL) !== count($value, COUNT_RECURSIVE)) + { + $value = json_encode($value); + } + // Setting the value for the field and the item $model->setFieldValue($field->id, $item->id, $value); }