Skip to content

Latest commit

 

History

History
51 lines (35 loc) · 1.06 KB

File metadata and controls

51 lines (35 loc) · 1.06 KB
title short-title slug page-type status browser-compat
DeprecationReportBody: toJSON() method
toJSON()
Web/API/DeprecationReportBody/toJSON
web-api-instance-method
experimental
api.DeprecationReportBody.toJSON

{{APIRef("Reporting API")}}{{SeeCompatTable}}

The toJSON() method of the {{domxref("DeprecationReportBody")}} interface is a serializer, and returns a JSON representation of the InterventionReportBody object.

Syntax

toJSON()

Parameters

None.

Return value

A JSON object that is the serialization of the {{domxref("DeprecationReportBody")}} object.

Examples

In this example we create a new {{domxref("ReportingObserver")}} to observe deprecation reports, then return a JSON representation of the first entry.

let options = {
  types: ["deprecation"],
  buffered: true,
};

let observer = new ReportingObserver((reports, observer) => {
  let firstReport = reports[0];
  console.log(firstReport.toJSON());
}, options);

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}