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

# toList

`fun <T> <ERROR CLASS>?.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#L28)

Convenience method to convert a JSONArray into a List

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

