Jump to content

Parser JSON, problème de lecture


Recommended Posts

Bonjour,

J'ai une problème pour parser une JSON de ce type :

{
"data": {
	"pid": 13756
},
"message": "Pong",
"result": "success"
}

Pour parser le json, j'utilise ce tuturiel.

Mon code est celui-ci :

JSONParser jParser = new JSONParser();
 JSONObject json = jParser.getJSONFromUrl(url+TAG_PING, http);
 String result = "failed";
 try {
  result = json.getString(TAG_RESULT);
 } catch (JSONException e) {
  // TODO Auto-generated catch block
  e.printStackTrace();
 }

Et au final, j'obtiens cette erreur là :

Error parsing data org.json.JSONException: Expected ':' after n at character 7 of {n	"data": {n		"pid": 13756n	}, n	"message": "Pong", n	"result": "success"n}n

Je débute dans le json et je me trompes peut-être dans la lecture du fichier.

Si vous voyez mon erreur ? Merci d'avance

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...