Ion Json Android

Asked

Viewed 608 times

1

I’m working with this library https://github.com/koush/ion and I am unable to manipulate the data return via JSON of the following format

[{"id":"1","nome":"XXX","cidade":"XXXXXXX"},{"id":"2","nome":"XXXX","cidade":"XX‌​XXXXXXXX"}] 

JsonObject json = new JsonObject();

Ion.with(context)
.load("http://example.com/post")
.setJsonObjectBody(json)
.asJsonObject()
.setCallback(new FutureCallback<JsonObject>() {
   @Override
    public void onCompleted(Exception e, JsonObject result) {
       // COMO TRABALHAR ELES AQUI????
    }
});
  • Have you been able to clear that up? Because I can’t work within: public void onCompleted(Exception e, Jsonobject result) { when I use the Ion structure within a method that I will instantiate in another class.

1 answer

-1

In this case, you need to pick up the return as .asJsonArray() and not as .asJsonObject().

Browser other questions tagged

You are not signed in. Login or sign up in order to post.