mapNotNull

fun <T> JSONObject.mapNotNull(transform: (Pair<String, Any>) -> T?): List<T>

Returns a list containing the results of applying the given transform function to each element in the original JSONObject. If the tranform returns null, it is not included in the output list.


inline fun <T> JSONArray.mapNotNull(transform: (Any) -> T?): List<T>

Returns a list containing the results of applying the given transform function to each element in the original JSONArray. If the tranform returns null, it is not included in the output list.