Skip to content

Commit 160a990

Browse files
committed
updated README to document JSONArrays
1 parent 28969da commit 160a990

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,23 @@ AsyncHttpClient.getDefaultInstance().getJSONObject(url, new AsyncHttpClient.JSON
6565
});
6666
```
6767

68+
Or for JSONArrays...
6869

70+
```java
71+
// url is the URL to download. The callback will be invoked on the UI thread
72+
// once the download is complete.
73+
AsyncHttpClient.getDefaultInstance().getJSONArray(url, new AsyncHttpClient.JSONArrayCallback() {
74+
// Callback is invoked with any exceptions/errors, and the result, if available.
75+
@Override
76+
public void onCompleted(Exception e, AsyncHttpResponse response, JSONArray result) {
77+
if (e != null) {
78+
e.printStackTrace();
79+
return;
80+
}
81+
System.out.println("I got a JSONArray: " + result);
82+
}
83+
});
84+
```
6985

7086

7187
### Download a url to a file

0 commit comments

Comments
 (0)