Why does JSON.stringify return empty object notation {} for an object that seems to have properties?
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.