--- title: Performance.toJSON() slug: Web/API/Performance/toJSON translation_of: Web/API/Performance/toJSON ---
toJSON() 方法是一个标准的串行器:它返回一个由 performance 对象各个属性组成的 JSONmyPerf = performance.toJSON()
var js;
js = window.performance.toJSON();
console.log("json = " + JSON.stringify(js));
| Specification | Status | Comment |
|---|---|---|
| {{SpecName('Highres Time Level 2', '#the-performance-interface', 'toJSON() serializer')}} | {{Spec2('Highres Time Level 2')}} | Defines toJson(). |
{{Compat("api.Performance.toJSON")}}