I am currently attempting to extract the JSON object from a string that has been outputted in JSON format from a Rails application. In my JavaScript code, I have the following:
data = "<%= @chromosomes.html_safe %>";
The issue I am facing is that due to the presence of quotes at the beginning and end of the JSON object, it is not being recognized as a valid JSON object. This results in something like:
data = "[{"name":"YHet","organism_id":"4ea9b90e859723d3f7000037"}]"
Is there a method I can utilize to eliminate the leading and trailing quotes so that the object is treated as an array rather than a string?