json - Unexpected character(<) position 0 Java -
json - Unexpected character(<) position 0 Java -
i have little problem json parser
when seek parse string exception:
unexpected character (<) @ position 0 but dont see problem is. code made:
jsonparser parser = new jsonparser(); seek { object obj = parser.parse(response); system.out.println(obj); jsonobject jsonobject = (jsonobject) obj; // loop string //id = (string) jsonobject.get("id"); voornaam = (string) jsonobject.get("voornaam"); achternaam = (string) jsonobject.get("achternaam"); _voornaamtxtfield.settext(voornaam); _achternaamtxtfield.settext(achternaam); } grab (parseexception pex) { joptionpane.showmessagedialog(null, "parseexception", "error", joptionpane.error_message); system.out.println(pex); } grab (nullpointerexception npex) { joptionpane.showmessagedialog(null, "nullpointerexception", "error", joptionpane.error_message); } can explain me doeing cause exception
your response string not json. xml. if response response http call, need specify content type "application/json", may service homecoming json string, if service supports that.
java json parsing
Comments
Post a Comment