Clicky

Java, Spring, Javascript: errorThrown SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data

March 4, 2015

Problema:
errorThrown SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data

Solucion:
JSON esta esperando por lo menos un array vacio, un objecto tipo String (return new String()) no es suficiente.

@RequestMapping("/xxx”)
public @ResponseBody String[] xxx(HttpServletRequest request, @RequestParam(“xxxx”) String xxx) {
            (…)
            return new String[]{""};
        }
}