This page was translated from English by the community. Learn more and join the MDN Web Docs community.

View in English Always switch to English

RTCIceCandidate. toJSON()

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨2017년 9월⁩.

RTCIceCandidate 메소드인 toJSON() 은 JSON 형식으로 호출된 RTCIceCandidate를 RTCIceCandidateInit 객체 형식으로 변환합니다. .

Syntax

js
json = RTCIceCandidate.toJSON();

반환 값

RTCIceCandidateInit 딕셔너리에 상응하는 객체로, RTCIceCandidate 객체의 해당하는 값으로 설정됩니다.

반환된 객체에 대한 문자열화된 버전의 객체는 stringify()를 호출해서 가져올 수 있습니다. 아래의 예시를 참조하십시오.

예시

아래의 샘플 코드는 candidate 변수의 RTCIceCandidate를 나타내는 JSON 문자열을 가져옵니다.

js
var jsonString = candidate.toJSON().stringify();

명세

Specification
WebRTC: Real-Time Communication in Browsers
# dom-rtcicecandidate-tojson

브라우저 호환성