Make it JSON compliant
JSON.parse(user_roles.replace(/(?
This works by fixing the reason why your code can't be parsed by JSON. That reason is that JSON doesn't let you use single quotes (') so we change them to Double Quotes (")
EDIT:
I made it so that when a '
is preceded by a \
it will not be replaced with a "
.