laravel/framework — pull request #3228 by anlutro (2014-01-14 13:02:52+00:00)
Title: [4.2] Implement JsonSerializable

A very neat interface added in PHP 5.4: http://www.php.net/manual/en/class.jsonserializable.php

This enables you do do `json_encode($object)` instead of having to go via `json_encode($object->toArray())` or `$object->toJson()`. The most useful example would be something like this:

`return Response::json(['result' => $result]);`

which wouldn't work - you'd currently have to do

`return Response::json(['result' => $result->toArray()]);`

More long term it might be a good idea to phase out every `toJson` implementation entirely in favour of this?