I'm trying to parse the following string to JSON and it does not seem to work due to the ampersand character \&\#38
. It throws an error on JSON.parse: SyntaxError: Unexpected token & at Object.parse (native)
{"pluginType":"cite","reference":{"title":"Mixed-Initiative Real-Time Topic Modeling \&\#38; Visualization for Crisis Counseling","url":"http://doi.acm.org/10.1145/2678025.2701395","pages":"417--426","year":"2015","publisher":"ACM","_id":"56d59ced7eb2323d008fab24","label":"Dinakar2015MRT26780252701395"}}
Can this be escaped somehow? It seems like valid input for a user.
JSON.parse('{"pluginType":"cite","reference":{"title":"Mixed-Initiative Real-Time Topic Modeling \&\#38; Visualization for Crisis Counseling","url":"http://doi.acm.org/10.1145/2678025.2701395","pages":"417--426","year":"2015","publisher":"ACM","_id":"56d59ced7eb2323d008fab24","label":"Dinakar2015MRT26780252701395"}}')
parses fine for me.'\&'
into the string&
. TryJSON.parse(String.raw`"\&"`)
instead.