Home > DeveloperSection > Forums > Handling JSON in Android
JAMES Williams
JAMES Williams

Total Post:7

Posted on    October-12-2015 6:21 AM

 Android Android  JSON 

 1 Reply(s)
 631  View(s)
Rate this:
I am working on  an android application, I would like to send messages in the form of JSON objects to a Django Server and parse the JSON response from the server and populate a custom listview.

From the little JSON knowledge I have, I thought this format for the response from server
  "post": {
    "username": "someusername",
    "message": "this is a sweet message",
    "image": "http://localhost/someimage.jpg",
    "time":  "present time"

Mayank Tripathi
Mayank Tripathi

Total Post:397

Posted on    October-12-2015 6:54 AM

Use GSon and Jackson :

We can actually bind to our own POJOs, not some half-assed tree nodes or Lists and Maps. (and at least Jackson allows binding to such things too (perhaps GSON as well, not sure), JsonNode, Map, List, if you really want these instead of 'real' objects)
Jackson.jr uses same fast Streaming parser/generator as Jackson (jackson-core), but data-binding part is tiny (50kB). Functionality is more limited (no annotations, just regular Java Beans), but performance-wise should be fast, and initialization (first-call) overhead very low as well. So it just might be good choice, especially for smaller apps.

You can use org.json.JSONObject  and org.json.JSONTokener you don't need any external libraries since these classes come with Android SDK

Don't want to miss updates? Please click the below button!

Follow MindStick