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.
Candidate Recommendation Defines toJson().

Browser compatibility

Update compatibility data on GitHub
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 ?

Legend

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