JSON Parser Error 783: unexpected token at for params

After much researching and what feels like infinity trial and error I stumbled upon the fix.

Basically, what seems to be happening is whenever the form currently has an image and is being edited, if the existing image isn't handled properly then it converts the cached_image data into a string. You can see a better explanation here.

The culprit turned out to be this line in my form:

<%= f.input :image, as: :hidden, value: f.object.cached_image_data %>

Once I changed it to the following it worked like a charm:

<%= f.input :image, as: :hidden, input_html: { value: f.object.cached_image_data } %>