title | short-title | slug | page-type | status | browser-compat | |
---|---|---|---|---|---|---|
DeprecationReportBody: toJSON() method |
toJSON() |
Web/API/DeprecationReportBody/toJSON |
web-api-instance-method |
|
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.
toJSON()
None.
A JSON object that is the serialization of the {{domxref("DeprecationReportBody")}} object.
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}}
{{Compat}}