title: Rails serialized JSON to string gives error on mysql JSON field
body: <p>I have an old table which used to save json to a string sql field using the Rails ActiveRecord serializer. I created a new table with the field datatype as JSON which was introduced in MySQL 5.7. But directly copying the data from the old field to the new one gives me JSON error saying the json structure is wrong.</p>
  
  <p>More specifically the problem is with unicode characters which my database does not support as of yet and the database is too large to just migrate everything to support it.</p>
  
  <p>I am looking for a way to migrate the data from the old field to the new JSON field</p>
  
  <p>I have seen that replacing <code>\u</code>for the unicode character to <code>\\u</code> in the JSON string solved the issue but I am not just able to do this:</p>
  
  <pre><code>update table_name set column_name=REPLACE(column_name, '\u', '\\u');
  </code></pre>
  
  <p>since it gives an error again</p>
  
  <pre><code>ERROR 3140 (22032): Invalid JSON text: "Invalid escape character in string." at position 564 in value for column 'table_name.column_name'.
  </code></pre>