Skip to content

Cannot parse result in JavaScript: "SyntaxError: Unexpected token" #1252

@chfritz

Description

@chfritz

There seem to be special unicode characters in the response from the backend that break javascript. This is also notable in the node-osrm package that, as of not too long ago, seems to break with an "Unexpected end of input" error when parsing the result from the backend.

I've already tried to replace all U+2028 and U+2029 characters in JavaScript, as recommended here
http://timelessrepo.com/json-isnt-a-javascript-subset, but this didn't solve the issue. I still get "SyntaxError: Unexpected token" when trying to parse the response from the backend into a JSON object.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions