Using `JSON.stringify`/`JSON.parse` to avoid Flash serialization woes

Fixes #373.