Saving to Table Field Type via Plugin I keep getting a server error when attempting to save data to a table field. This is the code I am using test data insertion. (251 is a valid enteryId)

    $entry = craft()-&gt;entries-&gt;getEntryById(251, $localeId = null);
    $arr = array('col1' =&gt; 'some sku', 'col2' =&gt; 'This is a big fat description', 'col3' =&gt; 495.00, 'col4' =&gt; 0);
    $arr = json_encode($arr);
    $entry-&gt;getContent()-&gt;gistDistribution = $arr;
    $success = craft()-&gt;entries-&gt;saveEntry($entry);


This is my error:

Internal Server Error
Illegal string offset 'sku'


Note: sku is a column name in my table field.
NOT TESTED


I think you can just add an array to gistDistribution, it will get
json_encoded before saving.
I think you'd have to set the variable like this:

$arr[0] = array(...);


That way, you provide a multidimensional array, which is what a table needs.