Changed serialize/unserialize to json encode/decode.

This better represents potential real world usage.