[android-components](../../index.md) / [mozilla.components.support.ktx.android.org.json](../index.md) / [org.json.JSONObject](index.md) / [tryGetLong](./try-get-long.md)

# tryGetLong

`fun `[`JSONObject`](https://developer.android.com/reference/org/json/JSONObject.html)`.tryGetLong(key: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`): `[`Long`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)`?` [(source)](https://github.com/mozilla-mobile/android-components/blob/master/components/support/ktx/src/main/java/mozilla/components/support/ktx/android/org/json/JSONObject.kt#L36)

Returns the value mapped by {@code key} if it exists, and
if the value returned is not null. If it's null, it returns null

