The RTCSessionDescription.toJSON() method generates a JSON description of the object. Both properties, type and sdp, are contained in the generated JSON.
toJSON()None.
A JSON object containing the following properties:
typeOne of the following: "offer", "answer", "pranswer" or null.
sdpEither null or the SDP message string corresponding to RTCSessionDescription.sdp property.
// sd is a RTCSessionDescriptor
alert(JSON.stringify(sd)); // This call the toJSON() method behind the scene.