Back to Content

NavigatorUAData: toJSON() method

files/en-us/web/api/navigatoruadata/tojson/index.md

latest933 B
Original Source

{{APIRef("User-Agent Client Hints API")}}{{SeeCompatTable}}{{AvailableInWorkers}}

The toJSON() method of the {{domxref("NavigatorUAData")}} interface is a serializer that returns a JSON representation of the low entropy properties of the NavigatorUAData object.

[!NOTE] The terms high entropy and low entropy refer to the amount of information these values reveal about the browser. The low entropy values returned by this method are those which do not reveal information able to identify a user. High entropy values can only be returned by the {{domxref("NavigatorUAData.getHighEntropyValues()")}} method.

Syntax

js-nolint
toJSON()

Parameters

None.

Return value

A JSON object.

Examples

The following example prints the JSON object to the console.

js
console.log(navigator.userAgentData.toJSON());

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}