I want to send data from my Android app to my server.
On the client-side, meaning the application,I can create the JSON object and send it to the server.
The problem is, I don’t know how to ‘handle’ it on the server side.All I want my server to do is to receive the JSON, parse it, and show it to me.That’s it.
I know it’s pretty vague question, but I don’t really know where to start here, and would love if anyone could show me a complete tutorial.
Thanks!
Use PHP and json_decode()
http://php.net/manual/en/function.json-decode.php
Here a quick example how to handle the data:
I used the GET parameter in this example. If you have larger data, use POST instead of GET.
Example:
URL: http://localhost/test/index.php?json={ “firstName” : “John”,”lastName” : “Doe”,”age” : 23 }
Output: Hello John Doe!
You are 23 years old! Wow.
But: Make sure you encode the JSON data at your application. In my example the browser does it.