[android-components](../../index.md) / [mozilla.components.browser.session.storage](../index.md) / [BrowserStateSerializer](index.md) / [toJSON](./to-j-s-o-n.md)

# toJSON

`fun toJSON(state: `[`BrowserState`](../../mozilla.components.browser.state.state/-browser-state/index.md)`): `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) [(source)](https://github.com/mozilla-mobile/android-components/blob/master/components/browser/session/src/main/java/mozilla/components/browser/session/storage/BrowserStateSerializer.kt#L25)

Serializes the provided [BrowserState](../../mozilla.components.browser.state.state/-browser-state/index.md) to JSON.

### Parameters

`state` - the state to serialize.

**Return**
the serialized state as JSON.

