The following example shows that JSON.stringify()
returns the string "{}"
for SpeechSynthesisVoice objects:
var voiceObject = window.speechSynthesis.getVoices()[0];
JSON.stringify(voiceObject); //returns "{}"?
Complete example: JSFiddle
Why does it return "{}"
and not something like "{voiceURI: "Google Deutsch", name: "Google Deutsch", lang: "de-DE", localService: false, default: false}"
?
Note that the above example does not work for chrome or iOS; it is targeted for Mozilla Firefox.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…