NotRestoredReasonDetails: toJSON() method

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

The toJSON() method of the NotRestoredReasonDetails interface is a serializer; it returns a JSON representation of the NotRestoredReasonDetails object.

Syntax

js
toJSON()

Parameters

None.

Return value

A JSON object that is the serialization of the NotRestoredReasonDetails object.

Examples

The following function will return a JSON representation of the first NotRestoredReasonDetails object of the NotRestoredReasons object from the first PerformanceNavigationTiming object currently present in the performance timeline:

js
function returnNRR() {
  const navEntries = performance.getEntriesByType("navigation");
  let navEntry = navEntries[0];
  return navEntry.notRestoredReasons.reasons[0].toJSON();
}

Specifications

Specification
HTML Standard
# notrestoredreasondetails

Browser compatibility

BCD tables only load in the browser

See also