Introduce support for JsonSerializable

To allow methods to return raw objects, we should introduce support for the [JsonSerializable](http://php.net/manual/en/class.jsonserializable.php) interface.

In order to do this in a <5.4-compatible manner, this will require walking arrays and such, plus a compatibility interface. Worth it, IMO.