Get to know MDN better
このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docs コミュニティーについてもっと知り、仲間になるにはこちらから。
Since September 2024, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.
toJSON() は GeolocationPosition インターフェイスのメソッドで、シリアライザーです。これはこの GeolocationPosition オブジェクトの JSON 表現を返します。
なし。
JSON オブジェクトです。この GeolocationPosition オブジェクトをシリアライズしたものです。
この例では、position.coords.toJSON() を呼び出すと、その GeolocationPosition オブジェクトの JSON 表現を返します。
これは次のような JSON オブジェクトをログ出力します。
JSON 文字列を取得するには、JSON.stringify(position) を直接呼び出してください。これは toJSON() を自動的に呼び出します。
| Geolocation # tojson-method |
Enable JavaScript to view this browser compatibility table.
This page was last modified on 2025年12月17日 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.