How can I convert a hash representation in an escaped string to an actual hash?

I have a field stored in a MySQL db that is a string, but it is storing a representation of a hash. I'm wondering how I could convert this string into a hash. I have tried a bunch of different things with gsub and JSON.parse to no avail.

Here is a reference to what I'm trying to convert:

=> "{:address=>\"\", :city=>\"\", :country=>\"\", :zip=>\"\", :state=>\"\", :industry=>\"\", :org=>\"\", :job_title=>\"\", :purchasing_time_frame=>\"\", :role_in_purchase_process=>\"\", :no_of_employees=>\"\", :comments=>\"\", :custom_questions=>[{\"title\"=>\"License Number\", \"value\"=>\"345g3245\"}, {\"title\"=>\"License Type\", \"value\"=>\"Legal\"}], :create_time=>\"2022-01-17T22:49:26Z\"}" 


from Recent Questions - Stack Overflow https://ift.tt/3GQ9YgM
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation