[android-components](../../index.md) / [mozilla.components.support.ktx.android.org.json](../index.md) / [org.json.JSONArray](index.md) / [toList](./to-list.md)

# toList

`fun <T> `[`JSONArray`](https://developer.android.com/reference/org/json/JSONArray.html)`?.toList(): `[`List`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html)`<`[`T`](to-list.md#T)`>` [(source)](https://github.com/mozilla-mobile/android-components/blob/master/components/support/ktx/src/main/java/mozilla/components/support/ktx/android/org/json/JSONArray.kt#L35)

Convenience method to convert a JSONArray into a List

**Return**
list with the JSONArray values, or an empty list if the JSONArray was null

