Bob Ippolito (@etrepum) on Haskell, Python, Erlang, JavaScript, etc.

SWX: The JSON equivalent for Flash


Aral Balkan has recently released SWX, a new data exchange format for Flash.

In his current implementation it's really two standards: A JSON-ish format based on PHP (bad idea) and a particular layout of SWF bytecode on the receiving end (good idea).

Creating another JSON-like format is stupid. I really don't know why he did that. There are plenty of fast parsers for JSON in PHP, which are almost certainly going to be faster and perhaps safer than scanning input with a regex and eval-ing it. Using eval in server-side code with untrusted input, no matter how good you think your input validation is, is just foolish

Generating SWF bytecode for the return value is a good idea. It's fast, compact (zlib compressible even), requires no parsing on the Flash end, and can be used cross-domain (with appropriate instrumentation) since it's just a loadMovie call. We actually do something very similar to SWX for essentially these reasons (that's a lot of what eswf is used for).

I'd like to see him give up on the PHP junk in exchange for JSON and add explicit hooks in the standard for cross-domain help (LocalConnection transport, support). All said, this could be a good thing for Flash developers and I'll be paying close attention to the project over the next few months.