This week's book giveaway is in the OCP forum.
We're giving away four copies of OCP Java SE 8 Programmer II Exam Study Guide and have Kathy Sierra, Bert Bates, & Elizabeth Robson on-line!
See this thread for details.
Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

java.lang .String cannot be converted into JSONObject  RSS feed

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi i used this tutorial to insert data in my online server .it works fine but i am unable to get json response.
It is showing" Error parsing data org.json.JSONException: Value success of type java.lang.String cannot be converted to JSONObject"
I am completely new to PHP and Json. please help

my insert.php is


and my CustomHttpClient.java


 
Rancher
Posts: 42975
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Print out the value of the JSON you're receiving so you know what you're dealing with.

I bet the problem is lines 5 to 12 of your PHP code - you're returning something that is not JSON.

And you shouldn't be doing a DB query if the code can't even connect to the DB.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!