{"action":"created","issue":{"url":"https://api.github.com/repos/thephpleague/booboo/issues/22","labels_url":"https://api.github.com/repos/thephpleague/booboo/issues/22/labels{/name}","comments_url":"https://api.github.com/repos/thephpleague/booboo/issues/22/comments","events_url":"https://api.github.com/repos/thephpleague/booboo/issues/22/events","html_url":"https://github.com/thephpleague/booboo/issues/22","id":65301556,"number":22,"title":"JsonFormatter outputs invalid JSON with multiple errors","user":{"login":"shadowhand","id":38203,"avatar_url":"https://avatars.githubusercontent.com/u/38203?v=3","gravatar_id":"","url":"https://api.github.com/users/shadowhand","html_url":"https://github.com/shadowhand","followers_url":"https://api.github.com/users/shadowhand/followers","following_url":"https://api.github.com/users/shadowhand/following{/other_user}","gists_url":"https://api.github.com/users/shadowhand/gists{/gist_id}","starred_url":"https://api.github.com/users/shadowhand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shadowhand/subscriptions","organizations_url":"https://api.github.com/users/shadowhand/orgs","repos_url":"https://api.github.com/users/shadowhand/repos","events_url":"https://api.github.com/users/shadowhand/events{/privacy}","received_events_url":"https://api.github.com/users/shadowhand/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-03-30T21:00:27Z","updated_at":"2015-06-27T20:39:04Z","closed_at":"2015-06-27T20:37:40Z","body":"When multiple errors are triggered within the context of a single page, the output renders as:\r\n\r\n```json\r\n{\"message\": \"...\"}{\"message\": \"...\"}\r\n```\r\n\r\nThis is obviously invalid JSON and will not validate or convert properly. Expected output could be:\r\n\r\n```json\r\n{\"errors\": [{\"message\": \"...\"}, {\"message\": \"...\"}]}\r\n```\r\n\r\nWhile it is not entirely obvious to me how this would be implemented, some kind of handler \"before\" and \"after\" method should make it possible to break it up as:\r\n\r\n```php\r\n$before = '{\"errors\": [';\r\n$after = ']}';\r\n```"},"comment":{"url":"https://api.github.com/repos/thephpleague/booboo/issues/comments/116137193","html_url":"https://github.com/thephpleague/booboo/issues/22#issuecomment-116137193","issue_url":"https://api.github.com/repos/thephpleague/booboo/issues/22","id":116137193,"user":{"login":"brandonsavage","id":197889,"avatar_url":"https://avatars.githubusercontent.com/u/197889?v=3","gravatar_id":"","url":"https://api.github.com/users/brandonsavage","html_url":"https://github.com/brandonsavage","followers_url":"https://api.github.com/users/brandonsavage/followers","following_url":"https://api.github.com/users/brandonsavage/following{/other_user}","gists_url":"https://api.github.com/users/brandonsavage/gists{/gist_id}","starred_url":"https://api.github.com/users/brandonsavage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brandonsavage/subscriptions","organizations_url":"https://api.github.com/users/brandonsavage/orgs","repos_url":"https://api.github.com/users/brandonsavage/repos","events_url":"https://api.github.com/users/brandonsavage/events{/privacy}","received_events_url":"https://api.github.com/users/brandonsavage/received_events","type":"User","site_admin":false},"created_at":"2015-06-27T20:39:04Z","updated_at":"2015-06-27T20:39:04Z","body":"The way that BooBoo works, it handles each error individually. I recommend using the blocking feature built into the runner:\r\n\r\n```\r\n$booboo = new Runner();\r\n$booboo->treatErrorsAsExceptions(true);\r\n```"}}