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

Fixes #373.

Also sets up well for tackling #143 and #152.