There is an expression within a contenteditable div that looks like this:
{
name : "Jeff",
job : "rat whacker"
}
I am wondering how to convert this into a JS object?
If I extract the string from the div:
$("div").text();
...I would get this output:
"{\n name: \"Jeff\",\n job: \"rat whacker\"\n}"
Since this is not valid JSON, using JSON.parse won't work. How can I retrieve this as text and then assign it to a regular JSON object like this:
{
name : "Jeff",
job : "rat whacker"
}