Tag Archives: Java notes

Uncaught SyntaxError: Unexpected token o in JSON at position 1 [How to Solve]

JSON.parse(str); Error prompted during method execution;

The solution is very simple. Just pay attention to the format of STR parameter, which must be in the standard JSON string format

var str = '[{"code": "name", "name": "name"},{"code": "name1", "name": "name1"}]';

If the str value is passed through the background, be sure to confirm whether the format is correct