This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The toJSON() method of the PushSubscription interface is a standard serializer: it returns a JSON representation of the subscription properties, providing a useful shortcut.


​mySubscription = subscription.toJSON()




A JSON object. It currently only contains the subscription endpoint, as an endpoint member.


navigator.serviceWorker.ready.then(function(reg) {
  reg.pushManager.getSubscription().then(function(subscription) {
    var mySubscription = subscription.toJSON();
    // do something with subscription details


Specification Status Comment
Push API
The definition of 'PushSubscription (see serializer listed in the WebIDL)' in that specification.
Working Draft Initial definition.

Browser compatibility

Update compatibility data on GitHub
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidiOS SafariSamsung Internet
Basic support
Chrome Full support 42Edge ? Firefox ? IE No support NoOpera ? Safari ? WebView Android No support NoChrome Android Full support 50Edge Mobile ? Firefox Android ? Opera Android ? Safari iOS ? Samsung Internet Android Full support 5.0


Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown
Experimental. Expect behavior to change in the future.
Experimental. Expect behavior to change in the future.
Deprecated. Not for use in new websites.
Deprecated. Not for use in new websites.

Document Tags and Contributors

Contributors to this page: fscholz, chrisdavidmills, kitcambridge
Last updated by: fscholz,