Updated JS/PHP interface to use JSON encoding instead of PHP serialization.