performance.toJSON()

The toJSON() method of the Performance interface is a standard serializer: it returns a JSON representation of the performance object's properties.

Note: This feature is available in Web Workers.

Syntax

myPerf = performance.toJSON()

Arguments

None

Return value

myPerf
A JSON object that is the serialization of the Performance object.

Example

var js;
js = window.performance.toJSON();
console.log("json = " + JSON.stringify(js));

Specifications

Specification Status Comment
High Resolution Time Level 2
The definition of 'toJSON() serializer' in that specification.
Recommendation Defines toJson().

Browser compatibility

DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
toJSONChrome Full support 56Edge Full support 12Firefox Full support 25IE ? Opera No support NoSafari No support NoWebView Android Full support 56Chrome Android Full support 56Firefox Android Full support 25Opera Android No support NoSafari iOS No support NoSamsung Internet Android Full support 6.0

Legend

Full support
Full support
No support
No support
Compatibility unknown
Compatibility unknown