LOGSTASH-1626 - encode to JSON instead of ruby hash

Call `to_json` on the hash before sending it on.  Also add some tests.

Both `encode()` and `decode()` still seem mostly borked to me.  Planning to fix in separate PR.