I have a small problem with my json parser
When i try to parse a string i get this exception:
Unexpected character (<) at position 0
But i dont see where the problem is. This is the code that i made:
JSONParser parser = new JSONParser();
try {
Object obj = parser.parse(response);
System.out.println(obj);
JSONObject jsonObject = (JSONObject) obj;
// loop the string
//id = (String) jsonObject.get("id");
voornaam = (String) jsonObject.get("voornaam");
achternaam = (String) jsonObject.get("achternaam");
_voornaamTxtField.setText(voornaam);
_achternaamTxtField.setText(achternaam);
} catch (ParseException pex) {
JOptionPane.showMessageDialog(null, "ParseException",
"Error", JOptionPane.ERROR_MESSAGE);
System.out.println(pex);
} catch (NullPointerException npex) {
JOptionPane.showMessageDialog(null, "NullpointerException",
"Error", JOptionPane.ERROR_MESSAGE);
}
Can someone explain to me what i am doeing to cause the exception