rails convert to json code example
Example 1: railsparse json to object
hash = JSON.parse string
Example 2: rails to json
// Used in Rails 6
// Inside your template you can have a Model converted in Json (Javascript)
// adding:
const JavascriptVariable = <%=raw @model.to_json() %>;