How do I completely overwrite an array in JSON serialized data field I am storing an array as a JSON encoded serialized data field in Drupal 7 using the Serialized Field module. 

If I have an array of 20 elements and try to overwrite it with an array of 10 elements, I would expect to only have 10 elements in the field. But instead I am getting the 10 elements (keys 0-9) from my new array AND THEN the higher keyed elements from the old array (10-19).

Is there a way to empty out the old previously stored array values before writing the new array values?

I have tried the following but nothing completely overwrites the field:

$node-&gt;field_test[LANGUAGE_NONE][0]['value'] = "";

$node-&gt;field_test[LANGUAGE_NONE][0]['value'] = NULL;

$node-&gt;field_test[LANGUAGE_NONE][0]['value'] = array();

$node-&gt;field_test[LANGUAGE_NONE][0]['value'] = array(NULL);

$node-&gt;field_test = array(NULL);

$node-&gt;field_test = NULL;
A colleague suggested a solution that worked.

The Field Settings has a group of settings called "Serialization Options" which includes a checkbox option for "Namespace the data". In my initial configuration that box was checked. I unchecked the box and saved the field settings and my problem was solved.

Final solution: Uncheck "Namespace the data" in the Field Settings.