First, thanks tp Tomaselli for this tip on how to get the JSON data type to "work"!
One thing I've noted in testing is that I had extra slashes being added for special characters that the user typed into the fields I was storing into the JSON field, e.g. ', ", etc.
Adding the following code to the fork for my item model took care of things:
protected function prepareTable($table)
{
$table->customoptions = stripslashes($table->customoptions);
parent::prepareTable($table);
}
Without digging into this in any detail, my assumption is that the data is being prepared for an SQL update/insert statement and slashes are added for that before the JSON encode, which then means that more slashes are being added to the data (and removing them here before the jsonencode call fixes things.)
If I'm missing something I'd love to hear from the experts here
Thanks!
Dave