← Back to release summary

toJSON for GeolocationCoordinates and GeolocationPosition

Category
Device
Type
Chromium catches up
Status
Enabled by default (Chrome 126)
Intent stage
None

Summary

Add .toJSON() methods to the GeolocationCoordinates and GeolocationPosition interfaces. These methods will aid in developing automated tests for the Geolocation API and may be useful for debugging as well. If the API were developed today, these WebIDL interfaces would likely be WebIDL dictionaries instead. However, given compatibility constraints, this is the next best option for making these types serializable.

Motivation

Enables serialization of these objects with JSON.stringify().

Standards & signals

View on chromestatus.com